| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 static jboolean GetAcceptCookiesEnabled(JNIEnv* env, | 201 static jboolean GetAcceptCookiesEnabled(JNIEnv* env, |
| 202 const JavaParamRef<jobject>& obj) { | 202 const JavaParamRef<jobject>& obj) { |
| 203 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_COOKIES); | 203 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_COOKIES); |
| 204 } | 204 } |
| 205 | 205 |
| 206 static jboolean GetAcceptCookiesManaged(JNIEnv* env, | 206 static jboolean GetAcceptCookiesManaged(JNIEnv* env, |
| 207 const JavaParamRef<jobject>& obj) { | 207 const JavaParamRef<jobject>& obj) { |
| 208 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_COOKIES); | 208 return IsContentSettingManaged(CONTENT_SETTINGS_TYPE_COOKIES); |
| 209 } | 209 } |
| 210 | 210 |
| 211 static jboolean GetAutoplayEnabled(JNIEnv* env, |
| 212 const JavaParamRef<jobject>& obj) { |
| 213 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_AUTOPLAY); |
| 214 } |
| 215 |
| 211 static jboolean GetBackgroundSyncEnabled(JNIEnv* env, | 216 static jboolean GetBackgroundSyncEnabled(JNIEnv* env, |
| 212 const JavaParamRef<jobject>& obj) { | 217 const JavaParamRef<jobject>& obj) { |
| 213 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC); | 218 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC); |
| 214 } | 219 } |
| 215 | 220 |
| 216 static jboolean GetBlockThirdPartyCookiesEnabled( | 221 static jboolean GetBlockThirdPartyCookiesEnabled( |
| 217 JNIEnv* env, | 222 JNIEnv* env, |
| 218 const JavaParamRef<jobject>& obj) { | 223 const JavaParamRef<jobject>& obj) { |
| 219 return GetPrefService()->GetBoolean(prefs::kBlockThirdPartyCookies); | 224 return GetPrefService()->GetBoolean(prefs::kBlockThirdPartyCookies); |
| 220 } | 225 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); | 673 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); |
| 669 | 674 |
| 670 // The one-time notice in the dialog. | 675 // The one-time notice in the dialog. |
| 671 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 676 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
| 672 ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()), | 677 ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()), |
| 673 WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()), | 678 WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()), |
| 674 base::Bind(&EnableDialogAboutOtherFormsOfBrowsingHistory, | 679 base::Bind(&EnableDialogAboutOtherFormsOfBrowsingHistory, |
| 675 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); | 680 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); |
| 676 } | 681 } |
| 677 | 682 |
| 683 static void SetAutoplayEnabled(JNIEnv* env, |
| 684 const JavaParamRef<jobject>& obj, |
| 685 jboolean allow) { |
| 686 HostContentSettingsMap* host_content_settings_map = |
| 687 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
| 688 host_content_settings_map->SetDefaultContentSetting( |
| 689 CONTENT_SETTINGS_TYPE_AUTOPLAY, |
| 690 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
| 691 } |
| 692 |
| 678 static void SetAllowCookiesEnabled(JNIEnv* env, | 693 static void SetAllowCookiesEnabled(JNIEnv* env, |
| 679 const JavaParamRef<jobject>& obj, | 694 const JavaParamRef<jobject>& obj, |
| 680 jboolean allow) { | 695 jboolean allow) { |
| 681 HostContentSettingsMap* host_content_settings_map = | 696 HostContentSettingsMap* host_content_settings_map = |
| 682 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); | 697 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
| 683 host_content_settings_map->SetDefaultContentSetting( | 698 host_content_settings_map->SetDefaultContentSetting( |
| 684 CONTENT_SETTINGS_TYPE_COOKIES, | 699 CONTENT_SETTINGS_TYPE_COOKIES, |
| 685 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 700 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
| 686 } | 701 } |
| 687 | 702 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 | 1106 |
| 1092 return ConvertJavaStringToUTF8(android_permission); | 1107 return ConvertJavaStringToUTF8(android_permission); |
| 1093 } | 1108 } |
| 1094 | 1109 |
| 1095 static void SetSupervisedUserId(JNIEnv* env, | 1110 static void SetSupervisedUserId(JNIEnv* env, |
| 1096 const JavaParamRef<jobject>& obj, | 1111 const JavaParamRef<jobject>& obj, |
| 1097 const JavaParamRef<jstring>& pref) { | 1112 const JavaParamRef<jstring>& pref) { |
| 1098 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1113 GetPrefService()->SetString(prefs::kSupervisedUserId, |
| 1099 ConvertJavaStringToUTF8(env, pref)); | 1114 ConvertJavaStringToUTF8(env, pref)); |
| 1100 } | 1115 } |
| OLD | NEW |