OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ | 5 #ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ |
6 #define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ | 6 #define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h" |
11 #include "content/public/browser/geolocation_permission_context.h" | 12 #include "content/public/browser/geolocation_permission_context.h" |
12 | 13 |
13 class GeolocationInfoBarQueueController; | |
14 class PrefService; | |
15 class Profile; | 14 class Profile; |
16 | 15 |
17 // Chrome specific implementation of GeolocationPermissionContext; manages | 16 // Chrome specific implementation of GeolocationPermissionContext; manages |
18 // Geolocation permissions flow, and delegates UI handling via | 17 // Geolocation permissions flow, and delegates UI handling via |
19 // GeolocationInfoBarQueueController. | 18 // GeolocationInfoBarQueueController. |
20 class ChromeGeolocationPermissionContext | 19 class ChromeGeolocationPermissionContext |
21 : public content::GeolocationPermissionContext { | 20 : public content::GeolocationPermissionContext { |
22 public: | 21 public: |
23 static ChromeGeolocationPermissionContext* Create(Profile* profile); | 22 explicit ChromeGeolocationPermissionContext(Profile* profile); |
24 | |
25 static void RegisterUserPrefs(PrefService *user_prefs); | |
26 | 23 |
27 // GeolocationPermissionContext implementation: | 24 // GeolocationPermissionContext implementation: |
28 virtual void RequestGeolocationPermission( | 25 virtual void RequestGeolocationPermission( |
29 int render_process_id, | 26 int render_process_id, |
30 int render_view_id, | 27 int render_view_id, |
31 int bridge_id, | 28 int bridge_id, |
32 const GURL& requesting_frame, | 29 const GURL& requesting_frame, |
33 base::Callback<void(bool)> callback) OVERRIDE; | 30 base::Callback<void(bool)> callback) OVERRIDE; |
34 virtual void CancelGeolocationPermissionRequest( | 31 virtual void CancelGeolocationPermissionRequest( |
35 int render_process_id, | 32 int render_process_id, |
36 int render_view_id, | 33 int render_view_id, |
37 int bridge_id, | 34 int bridge_id, |
38 const GURL& requesting_frame) OVERRIDE; | 35 const GURL& requesting_frame) OVERRIDE; |
39 | 36 |
40 protected: | 37 protected: |
41 explicit ChromeGeolocationPermissionContext(Profile* profile); | |
42 virtual ~ChromeGeolocationPermissionContext(); | 38 virtual ~ChromeGeolocationPermissionContext(); |
43 | 39 |
44 Profile* profile() const { return profile_; } | 40 Profile* profile() const { return profile_; } |
45 | 41 |
46 // Return an instance of the infobar queue controller, creating it | 42 // Return an instance of the infobar queue controller, creating it |
47 // if necessary. | 43 // if necessary. |
48 GeolocationInfoBarQueueController* QueueController(); | 44 GeolocationInfoBarQueueController* QueueController(); |
49 | 45 |
50 // Notifies whether or not the corresponding bridge is allowed to use | 46 // Notifies whether or not the corresponding bridge is allowed to use |
51 // geolocation via | 47 // geolocation via |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // This must only be accessed from the UI thread. | 91 // This must only be accessed from the UI thread. |
96 Profile* const profile_; | 92 Profile* const profile_; |
97 | 93 |
98 scoped_ptr<GeolocationInfoBarQueueController> | 94 scoped_ptr<GeolocationInfoBarQueueController> |
99 geolocation_infobar_queue_controller_; | 95 geolocation_infobar_queue_controller_; |
100 | 96 |
101 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext); | 97 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext); |
102 }; | 98 }; |
103 | 99 |
104 #endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ | 100 #endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ |
OLD | NEW |