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

Unified Diff: chrome/browser/android/location_settings.h

Issue 2709883005: Stubs for triggering the LSD in Clank (Closed)
Patch Set: Declare the dependency of components/location on WindowAndroid Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/location_settings.h
diff --git a/chrome/browser/android/location_settings.h b/chrome/browser/android/location_settings.h
index 5d7fa7ec9c42059e31453f18fd37c1ab01fa0f2a..a4db9a2e1a03ac9394c95a0794c80bb0ed68fbf8 100644
--- a/chrome/browser/android/location_settings.h
+++ b/chrome/browser/android/location_settings.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_
#define CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_
+#include "base/callback.h"
#include "base/macros.h"
namespace content {
@@ -23,6 +24,61 @@ class LocationSettings {
// still has the ability to request the permissions to be granted.
virtual bool CanSitesRequestLocationPermission(
content::WebContents* web_contents) = 0;
+
+ // Asynchronously checks if a prompt can be triggered to ask the user to turn
benwells 2017/02/28 06:51:38 Is it necessary for this to be async? It makes the
+ // on the system location setting on their device, and returns true iff a
+ // prompt can be triggered.
+ // In particular, returns false if the system location setting is already
+ // enabled or if some of the features required to trigger a system location
+ // setting prompt are not available.
+ virtual void CanPromptToEnableSystemLocationSetting(
+ const base::Callback<void(bool can_prompt)>& callback) = 0;
+
+ // An enum to describe the context in which a system location setting prompt
+ // is triggered to allow the prompt UI to be customized to the given context.
+ //
+ // Keep in sync with the PromptContext IntDef in
+ // https://cs.chromium.org/chromium/src/components/location/android/java/src/org/chromium/components/location/LocationUtils.java
benwells 2017/02/28 06:26:36 Nit: you can refer to source files as //components
+ enum PromptContext {
benwells 2017/02/28 07:03:26 This (and PromptOutcome) are a bit vague - there m
+ // Prompt triggered in the context of a user gesture on a web page or on
+ // a preliminary domain or app permission prompt.
+ GESTURE = 1,
benwells 2017/02/28 06:26:36 Nit: I think we should call this NON_SEARCH. We mi
+ // Prompt triggered in the context of a search.
+ SEARCH = 2,
+ };
+
+ // An enum to describe the outcome of a location setting prompt triggered by
+ // PromptToEnableSystemLocationSetting().
+ //
+ // Keep in sync with the PromptOutcome IntDef in
+ // https://cs.chromium.org/chromium/src/components/location/android/java/src/org/chromium/components/location/LocationUtils.java
+ enum PromptOutcome {
+ // The user accepted the prompt and the system location setting has been
+ // flipped to granted.
+ GRANTED = 1,
+
+ // The user rejected the prompt and the system location setting has not been
+ // flipped.
+ DENIED = 2,
+
+ // The prompt could not be triggered.
+ // When CanPromptToEnableSystemLocationSetting() returns true, this should
+ // only happen in exceptional circonstances, e.g.
+ // - In the case of a race condition where the system location setting is
+ // flipped elsewhere before the prompt could be triggered;
+ // - In the case where some of the features required to trigger a system
+ // location setting prompt became unavailable or unresponsive after the
+ // response from CanPromptToEnableSystemLocationSetting() was received.
+ NO_PROMPT = 3,
+ };
+
+ // Triggers a prompt to ask the user to turn on the system location setting on
+ // their device.
+ // The prompt will be triggered in the activity of the web contents.
+ virtual void PromptToEnableSystemLocationSetting(
+ const PromptContext prompt_context,
+ content::WebContents* web_contents,
+ const base::Callback<void(PromptOutcome prompt_outcome)>& callback) = 0;
};
#endif // CHROME_BROWSER_ANDROID_LOCATION_SETTINGS_H_

Powered by Google App Engine
This is Rietveld 408576698