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