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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // ChromeGeolocationPermissionContext implementation: | 63 // ChromeGeolocationPermissionContext implementation: |
64 // Decide whether the geolocation permission should be granted. | 64 // Decide whether the geolocation permission should be granted. |
65 // Calls PermissionDecided if permission can be decided non-interactively, | 65 // Calls PermissionDecided if permission can be decided non-interactively, |
66 // or NotifyPermissionSet if permission decided by presenting an | 66 // or NotifyPermissionSet if permission decided by presenting an |
67 // infobar to the user. Called on the UI thread. | 67 // infobar to the user. Called on the UI thread. |
68 virtual void DecidePermission(content::WebContents* web_contents, | 68 virtual void DecidePermission(content::WebContents* web_contents, |
69 const PermissionRequestID& id, | 69 const PermissionRequestID& id, |
70 const GURL& requesting_frame, | 70 const GURL& requesting_frame, |
71 const GURL& embedder, | 71 const GURL& embedder, |
| 72 const std::string& accept_button_label, |
72 base::Callback<void(bool)> callback); | 73 base::Callback<void(bool)> callback); |
73 | 74 |
74 // Called when permission is granted without interactively asking | 75 // Called when permission is granted without interactively asking |
75 // the user. Can be overridden to introduce additional UI flow. | 76 // the user. Can be overridden to introduce additional UI flow. |
76 // Should ultimately ensure that NotifyPermissionSet is called. | 77 // Should ultimately ensure that NotifyPermissionSet is called. |
77 // Called on the UI thread. | 78 // Called on the UI thread. |
78 virtual void PermissionDecided(const PermissionRequestID& id, | 79 virtual void PermissionDecided(const PermissionRequestID& id, |
79 const GURL& requesting_frame, | 80 const GURL& requesting_frame, |
80 const GURL& embedder, | 81 const GURL& embedder, |
81 base::Callback<void(bool)> callback, | 82 base::Callback<void(bool)> callback, |
82 bool allowed); | 83 bool allowed); |
83 | 84 |
84 // Create an PermissionQueueController. overriden in derived classes to | 85 // Create an PermissionQueueController. overriden in derived classes to |
85 // provide additional UI flow. Called on the UI thread. | 86 // provide additional UI flow. Called on the UI thread. |
86 virtual PermissionQueueController* CreateQueueController(); | 87 virtual PermissionQueueController* CreateQueueController(); |
87 | 88 |
88 private: | 89 private: |
89 // Removes any pending InfoBar request. | 90 // Removes any pending InfoBar request. |
90 void CancelPendingInfobarRequest(const PermissionRequestID& id); | 91 void CancelPendingInfobarRequest(const PermissionRequestID& id); |
91 | 92 |
| 93 // Creates and show an info bar. |
| 94 void CreateInfoBarRequest(const PermissionRequestID& id, |
| 95 const GURL& requesting_frame, |
| 96 const GURL& embedder, |
| 97 const std::string accept_button_label, |
| 98 base::Callback<void(bool)> callback); |
| 99 |
92 // These must only be accessed from the UI thread. | 100 // These must only be accessed from the UI thread. |
93 Profile* const profile_; | 101 Profile* const profile_; |
94 bool shutting_down_; | 102 bool shutting_down_; |
95 scoped_ptr<PermissionQueueController> permission_queue_controller_; | 103 scoped_ptr<PermissionQueueController> permission_queue_controller_; |
96 | 104 |
97 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext); | 105 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext); |
98 }; | 106 }; |
99 | 107 |
100 #endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ | 108 #endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ |
OLD | NEW |