| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/preferences/pref_service_bridge.h" | 5 #include "chrome/browser/android/preferences/pref_service_bridge.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 PrefService* local_state = g_browser_process->local_state(); | 445 PrefService* local_state = g_browser_process->local_state(); |
| 446 local_state->SetBoolean(metrics::prefs::kMetricsReportingEnabled, enabled); | 446 local_state->SetBoolean(metrics::prefs::kMetricsReportingEnabled, enabled); |
| 447 } | 447 } |
| 448 | 448 |
| 449 static jboolean HasSetMetricsReporting(JNIEnv* env, | 449 static jboolean HasSetMetricsReporting(JNIEnv* env, |
| 450 const JavaParamRef<jobject>& obj) { | 450 const JavaParamRef<jobject>& obj) { |
| 451 PrefService* local_state = g_browser_process->local_state(); | 451 PrefService* local_state = g_browser_process->local_state(); |
| 452 return local_state->HasPrefPath(metrics::prefs::kMetricsReportingEnabled); | 452 return local_state->HasPrefPath(metrics::prefs::kMetricsReportingEnabled); |
| 453 } | 453 } |
| 454 | 454 |
| 455 static void SetClickedUpdateMenuItem(JNIEnv* env, |
| 456 const JavaParamRef<jobject>& obj, |
| 457 jboolean clicked) { |
| 458 GetPrefService()->SetBoolean(prefs::kClickedUpdateMenuItem, clicked); |
| 459 } |
| 460 |
| 461 static jboolean GetClickedUpdateMenuItem(JNIEnv* env, |
| 462 const JavaParamRef<jobject>& obj) { |
| 463 return GetPrefService()->GetBoolean(prefs::kClickedUpdateMenuItem); |
| 464 } |
| 465 |
| 455 namespace { | 466 namespace { |
| 456 | 467 |
| 457 // Redirects a BrowsingDataRemover completion callback back into Java. | 468 // Redirects a BrowsingDataRemover completion callback back into Java. |
| 458 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { | 469 class ClearBrowsingDataObserver : public BrowsingDataRemover::Observer { |
| 459 public: | 470 public: |
| 460 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a | 471 // |obj| is expected to be the object passed into ClearBrowsingData(); e.g. a |
| 461 // ChromePreference. | 472 // ChromePreference. |
| 462 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) | 473 ClearBrowsingDataObserver(JNIEnv* env, jobject obj) |
| 463 : weak_chrome_native_preferences_(env, obj) { | 474 : weak_chrome_native_preferences_(env, obj) { |
| 464 } | 475 } |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 ContentSettingsType content_type) { | 946 ContentSettingsType content_type) { |
| 936 JNIEnv* env = AttachCurrentThread(); | 947 JNIEnv* env = AttachCurrentThread(); |
| 937 base::android::ScopedJavaLocalRef<jstring> android_permission = | 948 base::android::ScopedJavaLocalRef<jstring> android_permission = |
| 938 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( | 949 Java_PrefServiceBridge_getAndroidPermissionForContentSetting( |
| 939 env, content_type); | 950 env, content_type); |
| 940 if (android_permission.is_null()) | 951 if (android_permission.is_null()) |
| 941 return std::string(); | 952 return std::string(); |
| 942 | 953 |
| 943 return ConvertJavaStringToUTF8(android_permission); | 954 return ConvertJavaStringToUTF8(android_permission); |
| 944 } | 955 } |
| OLD | NEW |