Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 class InfoBar; | 38 class InfoBar; |
| 39 } | 39 } |
| 40 | 40 |
| 41 class GURL; | 41 class GURL; |
| 42 class PermissionRequestID; | 42 class PermissionRequestID; |
| 43 class PrefRegistrySimple; | 43 class PrefRegistrySimple; |
| 44 | 44 |
| 45 class GeolocationPermissionContextAndroid | 45 class GeolocationPermissionContextAndroid |
| 46 : public GeolocationPermissionContext { | 46 : public GeolocationPermissionContext { |
| 47 public: | 47 public: |
| 48 enum class LocationSettingsDialogBackOff { | |
|
Ilya Sherman
2017/04/04 00:04:40
Please document that this enum is used to back an
benwells
2017/04/04 08:06:39
Done.
| |
| 49 kOneWeek, | |
| 50 kOneMonth, | |
| 51 kThreeMonths, | |
| 52 kMax, | |
|
Ilya Sherman
2017/04/04 00:04:40
nit: I'd suggest using "kCount" to mean "the numbe
benwells
2017/04/04 08:06:39
Done.
| |
| 53 }; | |
| 54 | |
| 55 static const char kGeolocationLSDShowDSEMetric[]; | |
| 56 static const char kGeolocationLSDShowNonDSEMetric[]; | |
| 57 static const char kGeolocationLSDSuppressDSEMetric[]; | |
| 58 static const char kGeolocationLSDSuppressNonDSEMetric[]; | |
| 59 static const char kGeolocationLSDAcceptDSEMetric[]; | |
| 60 static const char kGeolocationLSDAcceptNonDSEMetric[]; | |
| 61 static const char kGeolocationLSDDenyDSEMetric[]; | |
| 62 static const char kGeolocationLSDDenyNonDSEMetric[]; | |
| 63 | |
| 48 static void RegisterProfilePrefs(PrefRegistrySimple* registry); | 64 static void RegisterProfilePrefs(PrefRegistrySimple* registry); |
| 49 | 65 |
| 50 explicit GeolocationPermissionContextAndroid(Profile* profile); | 66 explicit GeolocationPermissionContextAndroid(Profile* profile); |
| 51 ~GeolocationPermissionContextAndroid() override; | 67 ~GeolocationPermissionContextAndroid() override; |
| 52 | 68 |
| 53 protected: | 69 protected: |
| 54 // GeolocationPermissionContext: | 70 // GeolocationPermissionContext: |
| 55 ContentSetting GetPermissionStatusInternal( | 71 ContentSetting GetPermissionStatusInternal( |
| 56 content::RenderFrameHost* render_frame_host, | 72 content::RenderFrameHost* render_frame_host, |
| 57 const GURL& requesting_origin, | 73 const GURL& requesting_origin, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 81 const GURL& embedding_origin, | 97 const GURL& embedding_origin, |
| 82 const BrowserPermissionCallback& callback, | 98 const BrowserPermissionCallback& callback, |
| 83 bool persist, | 99 bool persist, |
| 84 ContentSetting content_setting) override; | 100 ContentSetting content_setting) override; |
| 85 PermissionResult UpdatePermissionStatusWithDeviceStatus( | 101 PermissionResult UpdatePermissionStatusWithDeviceStatus( |
| 86 PermissionResult result, | 102 PermissionResult result, |
| 87 const GURL& requesting_origin, | 103 const GURL& requesting_origin, |
| 88 const GURL& embedding_origin) const override; | 104 const GURL& embedding_origin) const override; |
| 89 | 105 |
| 90 // Functions to handle back off for showing the Location Settings Dialog. | 106 // Functions to handle back off for showing the Location Settings Dialog. |
| 91 std::string GetLocationSettingsBackOffLevelPref( | 107 std::string GetLocationSettingsBackOffLevelPref(bool is_dse) const; |
| 92 const GURL& requesting_origin) const; | 108 std::string GetLocationSettingsNextShowPref(bool is_dse) const; |
| 93 std::string GetLocationSettingsNextShowPref( | 109 bool IsInLocationSettingsBackOff(bool is_dse) const; |
| 94 const GURL& requesting_origin) const; | 110 void ResetLocationSettingsBackOff(bool is_dse); |
| 95 bool IsInLocationSettingsBackOff(const GURL& requesting_origin) const; | 111 void UpdateLocationSettingsBackOff(bool is_dse); |
| 96 void ResetLocationSettingsBackOff(const GURL& requesting_origin); | 112 LocationSettingsDialogBackOff LocationSettingsBackOffLevel(bool is_dse) const; |
| 97 void UpdateLocationSettingsBackOff(const GURL& requesting_origin); | |
| 98 | 113 |
| 99 // Returns whether location access is possible for the given origin. Ignores | 114 // Returns whether location access is possible for the given origin. Ignores |
| 100 // Location Settings Dialog backoff, as the backoff is ignored if the user | 115 // Location Settings Dialog backoff, as the backoff is ignored if the user |
| 101 // will be prompted for permission. | 116 // will be prompted for permission. |
| 102 bool IsLocationAccessPossible(content::WebContents* web_contents, | 117 bool IsLocationAccessPossible(content::WebContents* web_contents, |
| 103 const GURL& requesting_origin, | 118 const GURL& requesting_origin, |
| 104 bool user_gesture); | 119 bool user_gesture); |
| 105 | 120 |
| 106 bool IsRequestingOriginDSE(const GURL& requesting_origin) const; | 121 bool IsRequestingOriginDSE(const GURL& requesting_origin) const; |
| 107 | 122 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 infobars::InfoBar* permission_update_infobar_; | 161 infobars::InfoBar* permission_update_infobar_; |
| 147 | 162 |
| 148 // Must be the last member, to ensure that it will be destroyed first, which | 163 // Must be the last member, to ensure that it will be destroyed first, which |
| 149 // will invalidate weak pointers. | 164 // will invalidate weak pointers. |
| 150 base::WeakPtrFactory<GeolocationPermissionContextAndroid> weak_factory_; | 165 base::WeakPtrFactory<GeolocationPermissionContextAndroid> weak_factory_; |
| 151 | 166 |
| 152 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); | 167 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContextAndroid); |
| 153 }; | 168 }; |
| 154 | 169 |
| 155 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ | 170 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_ANDROID_H_ |
| OLD | NEW |