[email protected] | c31d804 | 2014-08-06 16:35:39 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors. All rights reserved. |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |
6 | #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ | ||||
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 7 | |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 8 | #include "base/callback.h" |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame^] | 9 | #include "chrome/browser/content_settings/permission_context_base.h" |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 10 | #include "chrome/browser/geolocation/geolocation_permission_context_extensions.h" |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 11 | |
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 12 | namespace content { |
13 | class WebContents; | ||||
14 | } | ||||
15 | |||||
[email protected] | c0561cc8 | 2013-07-23 09:19:04 | [diff] [blame] | 16 | class PermissionRequestID; |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 17 | class Profile; |
18 | |||||
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame^] | 19 | class GeolocationPermissionContext : public PermissionContextBase { |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 20 | public: |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 21 | explicit GeolocationPermissionContext(Profile* profile); |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 22 | virtual ~GeolocationPermissionContext(); |
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 23 | |
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 24 | |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame^] | 25 | // In addition to the base class flow the geolocation permission request |
26 | // checks that it is only code from valid iframes. | ||||
27 | // It also adds special logic when called through an extension. | ||||
28 | virtual void RequestPermission(content::WebContents* web_contents, | ||||
29 | const PermissionRequestID& id, | ||||
30 | const GURL& requesting_frame_origin, | ||||
31 | bool user_gesture, | ||||
32 | const BrowserPermissionCallback& callback) OVERRIDE; | ||||
[email protected] | f068ad0e | 2014-02-11 13:48:23 | [diff] [blame] | 33 | |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame^] | 34 | // Adds special logic when called through an extension. |
35 | virtual void CancelPermissionRequest(content::WebContents* web_contents, | ||||
36 | const PermissionRequestID& id) OVERRIDE; | ||||
[email protected] | 3ab14c6 | 2012-10-18 01:50:22 | [diff] [blame] | 37 | |
38 | private: | ||||
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame^] | 39 | virtual void UpdateTabContext(const PermissionRequestID& id, |
40 | const GURL& requesting_frame, | ||||
41 | bool allowed) OVERRIDE; | ||||
[email protected] | 1b6a1c2 | 2014-05-27 23:23:14 | [diff] [blame] | 42 | |
miguelg | fa05207 | 2014-09-29 15:31:38 | [diff] [blame^] | 43 | // This must only be accessed from the UI thread. |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 44 | GeolocationPermissionContextExtensions extensions_context_; |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 45 | |
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 46 | DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); |
[email protected] | c476e63 | 2011-06-23 11:18:04 | [diff] [blame] | 47 | }; |
48 | |||||
[email protected] | 487974a | 2014-06-13 16:49:01 | [diff] [blame] | 49 | #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ |