Chromium Code Reviews| 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..ea75b3eb1d6aa2f720414bced25360917f452849 100644 |
| --- a/chrome/browser/geolocation/geolocation_permission_context_android.cc |
| +++ b/chrome/browser/geolocation/geolocation_permission_context_android.cc |
| @@ -157,6 +157,36 @@ 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. |
| + result.content_setting = CanShowLocationSettingsDialog( |
|
raymes
2017/03/10 02:53:31
Maybe we should update the result.status here, oth
benwells
2017/03/10 04:19:19
Done.
|
| + requesting_origin, true /* user_gesture */) |
| + ? CONTENT_SETTING_ASK |
| + : CONTENT_SETTING_BLOCK; |
|
raymes
2017/03/10 02:53:31
nit: This might be slightly clearer in the expande
benwells
2017/03/10 04:19:19
I've come to terms with the ternary operator, afte
|
| + } |
| + |
| + 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; |
| + } |
| + } |
| + |
| + return result; |
| +} |
| + |
| bool GeolocationPermissionContextAndroid::IsLocationAccessPossible( |
| content::WebContents* web_contents, |
| const GURL& requesting_origin, |
| @@ -170,7 +200,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 +235,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; |