| Index: chrome/browser/android/mock_location_settings.cc
|
| diff --git a/chrome/browser/android/mock_location_settings.cc b/chrome/browser/android/mock_location_settings.cc
|
| index 27de84236ed8144ee2d27fe5fc784440db383209..8a9c68d57dadab13dd14571eb69bbfbcdf740dd5 100644
|
| --- a/chrome/browser/android/mock_location_settings.cc
|
| +++ b/chrome/browser/android/mock_location_settings.cc
|
| @@ -4,8 +4,13 @@
|
|
|
| #include "chrome/browser/android/mock_location_settings.h"
|
|
|
| -bool MockLocationSettings::master_location_enabled = false;
|
| -bool MockLocationSettings::google_apps_location_enabled = false;
|
| +bool MockLocationSettings::has_android_location_permission_ = false;
|
| +bool MockLocationSettings::is_system_location_setting_enabled_ = false;
|
| +bool MockLocationSettings::can_prompt_for_android_location_permission_ = false;
|
| +bool MockLocationSettings::location_settings_dialog_enabled_ = false;
|
| +LocationSettingsDialogOutcome
|
| + MockLocationSettings::location_settings_dialog_outcome_ = NO_PROMPT;
|
| +bool MockLocationSettings::has_shown_location_settings_dialog_ = false;
|
|
|
| MockLocationSettings::MockLocationSettings() : LocationSettings() {
|
| }
|
| @@ -14,32 +19,48 @@ MockLocationSettings::~MockLocationSettings() {
|
| }
|
|
|
| void MockLocationSettings::SetLocationStatus(
|
| - bool master, bool google_apps) {
|
| - master_location_enabled = master;
|
| - google_apps_location_enabled = google_apps;
|
| + bool has_android_location_permission,
|
| + bool is_system_location_setting_enabled) {
|
| + has_android_location_permission_ = has_android_location_permission;
|
| + is_system_location_setting_enabled_ = is_system_location_setting_enabled;
|
| }
|
|
|
| -bool MockLocationSettings::IsGoogleAppsLocationSettingEnabled() {
|
| - return google_apps_location_enabled;
|
| +void MockLocationSettings::SetCanPromptForAndroidPermission(bool can_prompt) {
|
| + can_prompt_for_android_location_permission_ = can_prompt;
|
| }
|
|
|
| -bool MockLocationSettings::IsMasterLocationSettingEnabled() {
|
| - return master_location_enabled;
|
| +void MockLocationSettings::SetLocationSettingsDialogStatus(
|
| + bool enabled,
|
| + LocationSettingsDialogOutcome outcome) {
|
| + location_settings_dialog_enabled_ = enabled;
|
| + location_settings_dialog_outcome_ = outcome;
|
| }
|
|
|
| -bool MockLocationSettings::CanSitesRequestLocationPermission(
|
| +bool MockLocationSettings::HasShownLocationSettingsDialog() {
|
| + return has_shown_location_settings_dialog_;
|
| +}
|
| +
|
| +bool MockLocationSettings::HasAndroidLocationPermission() {
|
| + return has_android_location_permission_;
|
| +}
|
| +
|
| +bool MockLocationSettings::CanPromptForAndroidLocationPermission(
|
| content::WebContents* web_contents) {
|
| - return IsMasterLocationSettingEnabled() &&
|
| - IsGoogleAppsLocationSettingEnabled();
|
| + return can_prompt_for_android_location_permission_;
|
| +}
|
| +
|
| +bool MockLocationSettings::IsSystemLocationSettingEnabled() {
|
| + return is_system_location_setting_enabled_;
|
| }
|
|
|
| bool MockLocationSettings::CanPromptToEnableSystemLocationSetting() {
|
| - return false;
|
| + return location_settings_dialog_enabled_;
|
| }
|
|
|
| void MockLocationSettings::PromptToEnableSystemLocationSetting(
|
| const LocationSettingsDialogContext prompt_context,
|
| content::WebContents* web_contents,
|
| LocationSettingsDialogOutcomeCallback callback) {
|
| - std::move(callback).Run(LocationSettingsDialogOutcome::NO_PROMPT);
|
| + has_shown_location_settings_dialog_ = true;
|
| + std::move(callback).Run(location_settings_dialog_outcome_);
|
| }
|
|
|