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

Unified Diff: chrome/browser/geolocation/geolocation_permission_context_android.cc

Issue 2743603002: Reflect device status in geolocation permissions.request calls. (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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/geolocation/geolocation_permission_context_android.cc
diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.cc b/chrome/browser/geolocation/geolocation_permission_context_android.cc
index d13cd8d2a6816630df6274a832b7026824579949..6630c11551b958b53999b8efdd988ee65775d884 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_android.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_android.cc
@@ -157,6 +157,40 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet(
persist, content_setting);
}
+PermissionResult
+GeolocationPermissionContextAndroid::UpdatePermissionStatusWithDeviceStatus(
+ PermissionResult result,
+ const GURL& requesting_origin,
+ const GURL& embedding_origin) const {
+ if (base::FeatureList::IsEnabled(features::kLsdPermissionPrompt) &&
+ result.content_setting != CONTENT_SETTING_BLOCK) {
+ if (!location_settings_->IsSystemLocationSettingEnabled()) {
+ // As this is returning the status for possible future permission
+ // requests, whose gesture status is unknown, pretend there is a user
+ // gesture here. If there is a possibility of PROMPT (i.e. if there is a
+ // user gesture attached to the later request) that should be returned,
+ // not BLOCK.
+ if (CanShowLocationSettingsDialog(requesting_origin,
+ true /* user_gesture */)) {
+ result.content_setting = CONTENT_SETTING_ASK;
+ } else {
+ result.content_setting = CONTENT_SETTING_BLOCK;
+ }
+ result.source = PermissionStatusSource::UNSPECIFIED;
+ }
+
+ if (result.content_setting != CONTENT_SETTING_BLOCK &&
+ !location_settings_->HasAndroidLocationPermission()) {
+ // TODO(benwells): plumb through the RFH and use the associated
+ // WebContents to check that the android location can be prompted for.
+ result.content_setting = CONTENT_SETTING_ASK;
+ result.source = PermissionStatusSource::UNSPECIFIED;
+ }
+ }
+
+ return result;
+}
+
bool GeolocationPermissionContextAndroid::IsLocationAccessPossible(
content::WebContents* web_contents,
const GURL& requesting_origin,
@@ -170,7 +204,7 @@ bool GeolocationPermissionContextAndroid::IsLocationAccessPossible(
LocationSettingsDialogContext
GeolocationPermissionContextAndroid::GetLocationSettingsDialogContext(
- const GURL& requesting_origin) {
+ const GURL& requesting_origin) const {
bool is_dse_origin = false;
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile());
@@ -205,7 +239,7 @@ void GeolocationPermissionContextAndroid::HandleUpdateAndroidPermissions(
bool GeolocationPermissionContextAndroid::CanShowLocationSettingsDialog(
const GURL& requesting_origin,
- bool user_gesture) {
+ bool user_gesture) const {
if (!base::FeatureList::IsEnabled(features::kLsdPermissionPrompt))
return false;

Powered by Google App Engine
This is Rietveld 408576698