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

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

Issue 11186010: Update geolocation infobar to handle Android system settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Failed to upload Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/google_location_settings_helper.h"
6
7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h"
9 #include "jni/GoogleLocationSettingsHelper_jni.h"
10
11 using base::android::AttachCurrentThread;
12 using base::android::CheckException;
13 using base::android::ScopedJavaLocalRef;
14
15 GoogleLocationSettingsHelperFactory*
16 GoogleLocationSettingsHelper::helper_factory_ = NULL;
17
18 GoogleLocationSettingsHelper::GoogleLocationSettingsHelper() {
19 JNIEnv* env = AttachCurrentThread();
20 if (helper_factory_ == NULL) {
21 SetGoogleLocationSettingsHelperFactory(
22 new GoogleLocationSettingsHelperFactory());
23 }
24 java_google_location_settings_helper_.Reset(env,
25 helper_factory_->GetHelperInstance().obj());
26 }
27
28 GoogleLocationSettingsHelper::~GoogleLocationSettingsHelper() {
29 }
30
31 void GoogleLocationSettingsHelper::SetGoogleLocationSettingsHelperFactory(
32 GoogleLocationSettingsHelperFactory* factory) {
33 helper_factory_ = factory;
34 }
35
36 std::string GoogleLocationSettingsHelper::GetAcceptButtonLabel() {
37 JNIEnv* env = AttachCurrentThread();
38 ScopedJavaLocalRef<jstring> infobar_allow_text =
39 Java_GoogleLocationSettingsHelper_getInfoBarAcceptLabel(
40 env, java_google_location_settings_helper_.obj());
41 return ConvertJavaStringToUTF8(infobar_allow_text);
42 }
43
44 void GoogleLocationSettingsHelper::ShowGoogleLocationSettings() {
45 JNIEnv* env = AttachCurrentThread();
46 Java_GoogleLocationSettingsHelper_startGoogleLocationSettingsActivity(
47 env, java_google_location_settings_helper_.obj());
48 }
49
50 bool GoogleLocationSettingsHelper::IsGoogleAppsLocationSettingEnabled() {
51 JNIEnv* env = AttachCurrentThread();
52 return Java_GoogleLocationSettingsHelper_isGoogleAppsLocationSettingEnabled(
53 env, java_google_location_settings_helper_.obj());
54 }
55
56 bool GoogleLocationSettingsHelper::IsMasterLocationSettingEnabled() {
57 JNIEnv* env = AttachCurrentThread();
58 return Java_GoogleLocationSettingsHelper_isMasterLocationSettingEnabled(
59 env, java_google_location_settings_helper_.obj());
60 }
61
62 // Register native methods
63
64 bool GoogleLocationSettingsHelper::Register(JNIEnv* env) {
65 return RegisterNativesImpl(env);
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698