Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/browser/android/location_settings.h

Issue 2721293002: Show the Android Location Settings Dialog when sites want permission. (Closed)
Patch Set: Feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/location/android/location_settings_dialog_context.h" 10 #include "components/location/android/location_settings_dialog_context.h"
11 #include "components/location/android/location_settings_dialog_outcome.h" 11 #include "components/location/android/location_settings_dialog_outcome.h"
12 12
13 namespace content { 13 namespace content {
14 class WebContents; 14 class WebContents;
15 } 15 }
16 16
17 // This class determines whether Chrome can access the device's location, 17 // This class determines whether Chrome can access the device's location,
18 // i.e. whether location is enabled system-wide on the device. 18 // i.e. whether location is enabled system-wide on the device.
19 class LocationSettings { 19 class LocationSettings {
20 public: 20 public:
21 virtual ~LocationSettings() {} 21 virtual ~LocationSettings() {}
22 22
23 // Returns true if: 23 // Returns true if Chrome has location permission.
24 // - Location is enabled system-wide (in Android settings) 24 virtual bool HasAndroidLocationPermission() = 0;
25 // - The necessary location permission are granted to Chrome, or if Chrome 25
26 // still has the ability to request the permissions to be granted. 26 // Returns true if Chrome can prompt to get location permission.
27 virtual bool CanSitesRequestLocationPermission( 27 virtual bool CanPromptForAndroidLocationPermission(
28 content::WebContents* web_contents) = 0; 28 content::WebContents* web_contents) = 0;
29 29
30 // Returns true if the system location is enabled.
31 virtual bool IsSystemLocationSettingEnabled() = 0;
32
30 // Returns true iff a prompt can be triggered to ask the user to turn on the 33 // Returns true iff a prompt can be triggered to ask the user to turn on the
31 // system location setting on their device. 34 // system location setting on their device.
32 // In particular, returns false if the system location setting is already 35 // In particular, returns false if the system location setting is already
33 // enabled or if some of the features required to trigger a system location 36 // enabled or if some of the features required to trigger a system location
34 // setting prompt are not available. 37 // setting prompt are not available.
35 virtual bool CanPromptToEnableSystemLocationSetting() = 0; 38 virtual bool CanPromptToEnableSystemLocationSetting() = 0;
36 39
37 typedef base::OnceCallback<void(LocationSettingsDialogOutcome)> 40 typedef base::OnceCallback<void(LocationSettingsDialogOutcome)>
38 LocationSettingsDialogOutcomeCallback; 41 LocationSettingsDialogOutcomeCallback;
39 42
(...skipping 10 matching lines...) Expand all
50 // If you need to access in the callback an object that is not owned by the 53 // If you need to access in the callback an object that is not owned by the
51 // callback, you should ensure that the object has not been destroyed before 54 // callback, you should ensure that the object has not been destroyed before
52 // accessing it to prevent crashes, e.g. by using weak pointer semantics. 55 // accessing it to prevent crashes, e.g. by using weak pointer semantics.
53 virtual void PromptToEnableSystemLocationSetting( 56 virtual void PromptToEnableSystemLocationSetting(
54 const LocationSettingsDialogContext prompt_context, 57 const LocationSettingsDialogContext prompt_context,
55 content::WebContents* web_contents, 58 content::WebContents* web_contents,
56 LocationSettingsDialogOutcomeCallback callback) = 0; 59 LocationSettingsDialogOutcomeCallback callback) = 0;
57 }; 60 };
58 61
59 #endif // CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_ 62 #endif // CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698