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

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: Updates Created 8 years, 2 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 | 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 void GoogleLocationSettingsHelper::SetGoogleLocationSettingsHelperFactory(
29 GoogleLocationSettingsHelperFactory* factory) {
30 helper_factory_ = factory;
31 }
32
33 std::string GoogleLocationSettingsHelper::GetAcceptButtonLabel() {
34 JNIEnv* env = AttachCurrentThread();
35 ScopedJavaLocalRef<jstring> inforbar_allow_text =
36 Java_GoogleLocationSettingsHelper_getInfoBarAllowTextFromLocationSetting(
37 env, java_google_location_settings_helper_.obj());
38 return ConvertJavaStringToUTF8(inforbar_allow_text);
39 }
40
41 void GoogleLocationSettingsHelper::ShowGoogleLocationSettings() {
42 JNIEnv* env = AttachCurrentThread();
43 Java_GoogleLocationSettingsHelper_startGoogleLocationSettingsActivity(
44 env, java_google_location_settings_helper_.obj());
45 }
46
47 bool GoogleLocationSettingsHelper::IsPlatformSettingEnabled() {
48 JNIEnv* env = AttachCurrentThread();
49 return Java_GoogleLocationSettingsHelper_isGoogleAppsLocationSettingEnabled(
50 env, java_google_location_settings_helper_.obj());
51 }
52
53 // Register native methods
54
55 bool GoogleLocationSettingsHelper::Register(JNIEnv* env) {
56 return RegisterNativesImpl(env);
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698