| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ANDROID_LOCATION_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_ | 6 #define CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 class WebContents; | 12 class WebContents; |
| 13 } | 13 } |
| 14 | 14 |
| 15 // This class determines whether Chrome can access the device's location, | 15 // This class determines whether Chrome can access the device's location, |
| 16 // i.e. whether location is enabled system-wide on the device. | 16 // i.e. whether location is enabled system-wide on the device. |
| 17 class LocationSettings { | 17 class LocationSettings { |
| 18 public: | 18 public: |
| 19 virtual ~LocationSettings() {} | 19 virtual ~LocationSettings() {} |
| 20 | 20 |
| 21 // Returns true if: | 21 // Returns true if Chrome has location permission. |
| 22 // - Location is enabled system-wide (in Android settings) | 22 virtual bool HasAndroidLocationPermission() = 0; |
| 23 // - The necessary location permission are granted to Chrome, or if Chrome | 23 |
| 24 // still has the ability to request the permissions to be granted. | 24 // Returns true if Chrome can prompt to get location permission. |
| 25 virtual bool CanSitesRequestLocationPermission( | 25 virtual bool CanPromptForAndroidLocationPermission( |
| 26 content::WebContents* web_contents) = 0; | 26 content::WebContents* web_contents) = 0; |
| 27 | 27 |
| 28 // Returns true if the system location is enabled. |
| 29 virtual bool IsSystemLocationSettingEnabled() = 0; |
| 30 |
| 28 // Returns true iff a prompt can be triggered to ask the user to turn on the | 31 // Returns true iff a prompt can be triggered to ask the user to turn on the |
| 29 // system location setting on their device. | 32 // system location setting on their device. |
| 30 // In particular, returns false if the system location setting is already | 33 // In particular, returns false if the system location setting is already |
| 31 // enabled or if some of the features required to trigger a system location | 34 // enabled or if some of the features required to trigger a system location |
| 32 // setting prompt are not available. | 35 // setting prompt are not available. |
| 33 virtual bool CanPromptToEnableSystemLocationSetting() = 0; | 36 virtual bool CanPromptToEnableSystemLocationSetting() = 0; |
| 34 | 37 |
| 35 // An enum to describe the context in which a system location setting prompt | 38 // An enum to describe the context in which a system location setting prompt |
| 36 // is triggered to allow the prompt UI to be customized to the given context. | 39 // is triggered to allow the prompt UI to be customized to the given context. |
| 37 // | 40 // |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Triggers a prompt to ask the user to turn on the system location setting on | 78 // Triggers a prompt to ask the user to turn on the system location setting on |
| 76 // their device. | 79 // their device. |
| 77 // The prompt will be triggered in the activity of the web contents. | 80 // The prompt will be triggered in the activity of the web contents. |
| 78 virtual void PromptToEnableSystemLocationSetting( | 81 virtual void PromptToEnableSystemLocationSetting( |
| 79 const LocationSettingsDialogContext prompt_context, | 82 const LocationSettingsDialogContext prompt_context, |
| 80 content::WebContents* web_contents, | 83 content::WebContents* web_contents, |
| 81 LocationSettingsDialogOutcomeCallback callback) = 0; | 84 LocationSettingsDialogOutcomeCallback callback) = 0; |
| 82 }; | 85 }; |
| 83 | 86 |
| 84 #endif // CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_ | 87 #endif // CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_ |
| OLD | NEW |