summaryrefslogtreecommitdiffstats
path: root/chrome/android
diff options
context:
space:
mode:
authorcramya@chromium.org <cramya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-27 00:49:37 +0000
committercramya@chromium.org <cramya@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-27 00:49:37 +0000
commitcb2322e2bf590f64bd8dee08b418477138d51ae4 (patch)
tree91e12e9f3a58a7b47bc33e7af68291f7c7b1943a /chrome/android
parente5656ec4577ae074bd6b45c3fc715776b3f2c6f7 (diff)
downloadchromium_src-cb2322e2bf590f64bd8dee08b418477138d51ae4.zip
chromium_src-cb2322e2bf590f64bd8dee08b418477138d51ae4.tar.gz
chromium_src-cb2322e2bf590f64bd8dee08b418477138d51ae4.tar.bz2
Add Google Location Settings geolocation permission flow
Pre MR0 version in Android, we had an explicit "Enable Location" setting in Chrome that will show the infobar based on the settings. Post MR0, we use the combination of system master location setting and system google apps location setting to decide between 1. Showing the infobar with Allow button (if both master and google apps are turned on) 2. Showing the infobar with Settings button that will take user to Google Apps Location Setting activity (if master is on but google apps location setting is turned off) 3. Do not show infobar (if master is off) Above functionality has been added in this CL for both pre and post MR0 cases. This CL also removes the android unit_test for GeolocationEnabledDisabled. Since the android specific geolocation code is going to be refactored, this test along with few more android specific unit_tests will be added in an upcoming CL. CQ-DEPEND=0f28fce084f6010242360fb7b6633b8fd7296be4 Review URL: https://chromiumcodereview.appspot.com/11186010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164466 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/android')
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelper.java26
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelperStub.java47
2 files changed, 73 insertions, 0 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelper.java
new file mode 100644
index 0000000..b04eb4f
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelper.java
@@ -0,0 +1,26 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser;
+
+import org.chromium.base.CalledByNative;
+
+/**
+ * Helper interface to read the Google Apps location setting to update the infobar button label.
+ * Also, starts the Android Google Apps location settings activity upon request.
+ */
+public interface GoogleLocationSettingsHelper {
+
+ @CalledByNative
+ public String getInfoBarAcceptLabel();
+
+ @CalledByNative
+ public boolean isMasterLocationSettingEnabled();
+
+ @CalledByNative
+ public boolean isGoogleAppsLocationSettingEnabled();
+
+ @CalledByNative
+ public void startGoogleLocationSettingsActivity();
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelperStub.java b/chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelperStub.java
new file mode 100644
index 0000000..40f33e1
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/GoogleLocationSettingsHelperStub.java
@@ -0,0 +1,47 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser;
+
+import android.content.Context;
+
+import org.chromium.base.CalledByNative;
+
+/**
+ * Stub implementation in Chrome for GoogleLocationSettingsHelper.
+ */
+
+public class GoogleLocationSettingsHelperStub implements GoogleLocationSettingsHelper {
+
+ private Context mApplicationContext;
+
+ public GoogleLocationSettingsHelperStub(Context context) {
+ mApplicationContext = context.getApplicationContext();
+ }
+
+ @Override
+ public String getInfoBarAcceptLabel() {
+ return "Allow";
+ }
+
+ @Override
+ public boolean isMasterLocationSettingEnabled() {
+ return true;
+ }
+
+ @Override
+ public boolean isGoogleAppsLocationSettingEnabled() {
+ return true;
+ }
+
+ @Override
+ public void startGoogleLocationSettingsActivity() {
+ }
+
+ @CalledByNative
+ public static GoogleLocationSettingsHelper createInstance(Context context) {
+ return new GoogleLocationSettingsHelperStub(context);
+ }
+
+}