| 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_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ |
| 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ | 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ |
| 7 | 7 |
| 8 // The flow for geolocation permissions on Android needs to take into account | 8 // The flow for geolocation permissions on Android needs to take into account |
| 9 // the global geolocation settings so it differs from the desktop one. It | 9 // the global geolocation settings so it differs from the desktop one. It |
| 10 // works as follows. | 10 // works as follows. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/geolocation/geolocation_permission_context.h" | 26 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 class WebContents; | 29 class WebContents; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace infobars { | 32 namespace infobars { |
| 33 class InfoBar; | 33 class InfoBar; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace url { |
| 37 class Origin; |
| 38 } |
| 39 |
| 36 class LocationSettings; | 40 class LocationSettings; |
| 37 class GURL; | |
| 38 class PermissionRequestID; | 41 class PermissionRequestID; |
| 39 | 42 |
| 40 class GeolocationPermissionContextAndroid | 43 class GeolocationPermissionContextAndroid |
| 41 : public GeolocationPermissionContext { | 44 : public GeolocationPermissionContext { |
| 42 public: | 45 public: |
| 43 explicit GeolocationPermissionContextAndroid(Profile* profile); | 46 explicit GeolocationPermissionContextAndroid(Profile* profile); |
| 44 ~GeolocationPermissionContextAndroid() override; | 47 ~GeolocationPermissionContextAndroid() override; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 friend class GeolocationPermissionContextTests; | 50 friend class GeolocationPermissionContextTests; |
| 48 | 51 |
| 49 // GeolocationPermissionContext: | 52 // GeolocationPermissionContext: |
| 50 void RequestPermission( | 53 void RequestPermission(content::WebContents* web_contents, |
| 51 content::WebContents* web_contents, | 54 const PermissionRequestID& id, |
| 52 const PermissionRequestID& id, | 55 const url::Origin& requesting_frame_origin, |
| 53 const GURL& requesting_frame_origin, | 56 const BrowserPermissionCallback& callback) override; |
| 54 const BrowserPermissionCallback& callback) override; | |
| 55 void CancelPermissionRequest(content::WebContents* web_contents, | 57 void CancelPermissionRequest(content::WebContents* web_contents, |
| 56 const PermissionRequestID& id) override; | 58 const PermissionRequestID& id) override; |
| 57 | 59 |
| 58 void HandleUpdateAndroidPermissions(const PermissionRequestID& id, | 60 void HandleUpdateAndroidPermissions( |
| 59 const GURL& requesting_frame_origin, | 61 const PermissionRequestID& id, |
| 60 const GURL& embedding_origin, | 62 const url::Origin& requesting_frame_origin, |
| 61 const BrowserPermissionCallback& callback, | 63 const url::Origin& embedding_origin, |
| 62 bool permissions_updated); | 64 const BrowserPermissionCallback& callback, |
| 65 bool permissions_updated); |
| 63 | 66 |
| 64 // Overrides the LocationSettings object used to determine whether | 67 // Overrides the LocationSettings object used to determine whether |
| 65 // system and Chrome-wide location permissions are enabled. | 68 // system and Chrome-wide location permissions are enabled. |
| 66 void SetLocationSettingsForTesting(scoped_ptr<LocationSettings> settings); | 69 void SetLocationSettingsForTesting(scoped_ptr<LocationSettings> settings); |
| 67 | 70 |
| 68 scoped_ptr<LocationSettings> location_settings_; | 71 scoped_ptr<LocationSettings> location_settings_; |
| 69 | 72 |
| 70 // This is owned by the InfoBarService (owner of the InfoBar). | 73 // This is owned by the InfoBarService (owner of the InfoBar). |
| 71 infobars::InfoBar* permission_update_infobar_; | 74 infobars::InfoBar* permission_update_infobar_; |
| 72 | 75 |
| 73 // Must be the last member, to ensure that it will be destroyed first, which | 76 // Must be the last member, to ensure that it will be destroyed first, which |
| 74 // will invalidate weak pointers. | 77 // will invalidate weak pointers. |
| 75 base::WeakPtrFactory<GeolocationPermissionContextAndroid> weak_factory_; | 78 base::WeakPtrFactory<GeolocationPermissionContextAndroid> weak_factory_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); | 80 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ | 83 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ |
| OLD | NEW |