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

Side by Side Diff: chrome/browser/android/mock_location_settings.cc

Issue 2721293002: Show the Android Location Settings Dialog when sites want permission. (Closed)
Patch Set: Updated 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 #include "chrome/browser/android/mock_location_settings.h" 5 #include "chrome/browser/android/mock_location_settings.h"
6 6
7 bool MockLocationSettings::master_location_enabled = false; 7 bool MockLocationSettings::has_android_location_permission = false;
8 bool MockLocationSettings::google_apps_location_enabled = false; 8 bool MockLocationSettings::is_system_location_setting_enabled = false;
9 bool MockLocationSettings::can_prompt_for_android_location_permission = false;
10 bool MockLocationSettings::location_settings_dialog_enabled = false;
11 LocationSettings::LocationSettingsDialogOutcome
12 MockLocationSettings::location_settings_dialog_outcome =
13 LocationSettings::NO_PROMPT;
14 bool MockLocationSettings::has_shown_location_settings_dialog = false;
9 15
10 MockLocationSettings::MockLocationSettings() : LocationSettings() { 16 MockLocationSettings::MockLocationSettings() : LocationSettings() {
11 } 17 }
12 18
13 MockLocationSettings::~MockLocationSettings() { 19 MockLocationSettings::~MockLocationSettings() {
14 } 20 }
15 21
16 void MockLocationSettings::SetLocationStatus( 22 void MockLocationSettings::SetLocationStatus(bool android, bool system) {
17 bool master, bool google_apps) { 23 has_android_location_permission = android;
18 master_location_enabled = master; 24 is_system_location_setting_enabled = system;
19 google_apps_location_enabled = google_apps;
20 } 25 }
21 26
22 bool MockLocationSettings::IsGoogleAppsLocationSettingEnabled() { 27 void MockLocationSettings::SetCanPromptForAndroidPermission(bool can_prompt) {
23 return google_apps_location_enabled; 28 can_prompt_for_android_location_permission = can_prompt;
24 } 29 }
25 30
26 bool MockLocationSettings::IsMasterLocationSettingEnabled() { 31 void MockLocationSettings::SetLocationSettingsDialogStatus(
27 return master_location_enabled; 32 bool enabled,
33 LocationSettingsDialogOutcome outcome) {
34 location_settings_dialog_enabled = enabled;
35 location_settings_dialog_outcome = outcome;
28 } 36 }
29 37
30 bool MockLocationSettings::CanSitesRequestLocationPermission( 38 bool MockLocationSettings::HasShownLocationSettingsDialog() {
39 return has_shown_location_settings_dialog;
40 }
41
42 bool MockLocationSettings::HasAndroidLocationPermission() {
43 return has_android_location_permission;
44 }
45
46 bool MockLocationSettings::CanPromptForAndroidLocationPermission(
31 content::WebContents* web_contents) { 47 content::WebContents* web_contents) {
32 return IsMasterLocationSettingEnabled() && 48 return can_prompt_for_android_location_permission;
33 IsGoogleAppsLocationSettingEnabled(); 49 }
50
51 bool MockLocationSettings::IsSystemLocationSettingEnabled() {
52 return is_system_location_setting_enabled;
34 } 53 }
35 54
36 bool MockLocationSettings::CanPromptToEnableSystemLocationSetting() { 55 bool MockLocationSettings::CanPromptToEnableSystemLocationSetting() {
37 return false; 56 return location_settings_dialog_enabled;
38 } 57 }
39 58
40 void MockLocationSettings::PromptToEnableSystemLocationSetting( 59 void MockLocationSettings::PromptToEnableSystemLocationSetting(
41 const LocationSettingsDialogContext prompt_context, 60 const LocationSettingsDialogContext prompt_context,
42 content::WebContents* web_contents, 61 content::WebContents* web_contents,
43 LocationSettingsDialogOutcomeCallback callback) { 62 LocationSettingsDialogOutcomeCallback callback) {
44 std::move(callback).Run(LocationSettingsDialogOutcome::NO_PROMPT); 63 std::move(callback).Run(location_settings_dialog_outcome);
45 } 64 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698