OLD | NEW |
---|---|
(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> inforbar_allow_text = | |
John Knottenbelt
2012/10/24 12:49:02
nit: infobar_allow_text
Ramya
2012/10/24 23:16:06
Done.
| |
39 Java_GoogleLocationSettingsHelper_getInfoBarAllowTextFromLocationSetting( | |
40 env, java_google_location_settings_helper_.obj()); | |
41 return ConvertJavaStringToUTF8(inforbar_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 } | |
OLD | NEW |