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 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/profiles/profile_manager.h" | 31 #include "chrome/browser/profiles/profile_manager.h" |
32 #include "chrome/browser/translate/chrome_translate_client.h" | 32 #include "chrome/browser/translate/chrome_translate_client.h" |
33 #include "chrome/browser/ui/android/android_about_app_info.h" | 33 #include "chrome/browser/ui/android/android_about_app_info.h" |
34 #include "chrome/common/chrome_features.h" | 34 #include "chrome/common/chrome_features.h" |
35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
36 #include "components/browsing_data/core/browsing_data_utils.h" | 36 #include "components/browsing_data/core/browsing_data_utils.h" |
37 #include "components/browsing_data/core/pref_names.h" | 37 #include "components/browsing_data/core/pref_names.h" |
38 #include "components/content_settings/core/browser/host_content_settings_map.h" | 38 #include "components/content_settings/core/browser/host_content_settings_map.h" |
39 #include "components/content_settings/core/common/content_settings.h" | 39 #include "components/content_settings/core/common/content_settings.h" |
40 #include "components/content_settings/core/common/content_settings_pattern.h" | 40 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 41 #include "components/content_settings/core/common/content_settings_utils.h" |
41 #include "components/content_settings/core/common/pref_names.h" | 42 #include "components/content_settings/core/common/pref_names.h" |
42 #include "components/metrics/metrics_pref_names.h" | 43 #include "components/metrics/metrics_pref_names.h" |
43 #include "components/password_manager/core/common/password_manager_pref_names.h" | 44 #include "components/password_manager/core/common/password_manager_pref_names.h" |
44 #include "components/prefs/pref_service.h" | 45 #include "components/prefs/pref_service.h" |
45 #include "components/safe_browsing/common/safe_browsing_prefs.h" | 46 #include "components/safe_browsing/common/safe_browsing_prefs.h" |
46 #include "components/signin/core/common/signin_pref_names.h" | 47 #include "components/signin/core/common/signin_pref_names.h" |
47 #include "components/strings/grit/components_locale_settings.h" | 48 #include "components/strings/grit/components_locale_settings.h" |
48 #include "components/translate/core/browser/translate_pref_names.h" | 49 #include "components/translate/core/browser/translate_pref_names.h" |
49 #include "components/translate/core/browser/translate_prefs.h" | 50 #include "components/translate/core/browser/translate_prefs.h" |
50 #include "components/version_info/version_info.h" | 51 #include "components/version_info/version_info.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const JavaParamRef<jobject>& list) { | 187 const JavaParamRef<jobject>& list) { |
187 HostContentSettingsMap* host_content_settings_map = | 188 HostContentSettingsMap* host_content_settings_map = |
188 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); | 189 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
189 ContentSettingsForOneType entries; | 190 ContentSettingsForOneType entries; |
190 host_content_settings_map->GetSettingsForOneType( | 191 host_content_settings_map->GetSettingsForOneType( |
191 static_cast<ContentSettingsType>(content_settings_type), "", &entries); | 192 static_cast<ContentSettingsType>(content_settings_type), "", &entries); |
192 for (size_t i = 0; i < entries.size(); ++i) { | 193 for (size_t i = 0; i < entries.size(); ++i) { |
193 Java_PrefServiceBridge_addContentSettingExceptionToList( | 194 Java_PrefServiceBridge_addContentSettingExceptionToList( |
194 env, list, content_settings_type, | 195 env, list, content_settings_type, |
195 ConvertUTF8ToJavaString(env, entries[i].primary_pattern.ToString()), | 196 ConvertUTF8ToJavaString(env, entries[i].primary_pattern.ToString()), |
196 entries[i].setting, ConvertUTF8ToJavaString(env, entries[i].source)); | 197 content_settings::ValueToContentSetting(entries[i].setting_value.get()), |
| 198 ConvertUTF8ToJavaString(env, entries[i].source)); |
197 } | 199 } |
198 } | 200 } |
199 | 201 |
200 static jboolean GetAcceptCookiesEnabled(JNIEnv* env, | 202 static jboolean GetAcceptCookiesEnabled(JNIEnv* env, |
201 const JavaParamRef<jobject>& obj) { | 203 const JavaParamRef<jobject>& obj) { |
202 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_COOKIES); | 204 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_COOKIES); |
203 } | 205 } |
204 | 206 |
205 static jboolean GetAcceptCookiesUserModifiable( | 207 static jboolean GetAcceptCookiesUserModifiable( |
206 JNIEnv* env, | 208 JNIEnv* env, |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1013 .obj(), | 1015 .obj(), |
1014 out); | 1016 out); |
1015 } | 1017 } |
1016 | 1018 |
1017 static void SetSupervisedUserId(JNIEnv* env, | 1019 static void SetSupervisedUserId(JNIEnv* env, |
1018 const JavaParamRef<jobject>& obj, | 1020 const JavaParamRef<jobject>& obj, |
1019 const JavaParamRef<jstring>& pref) { | 1021 const JavaParamRef<jstring>& pref) { |
1020 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1022 GetPrefService()->SetString(prefs::kSupervisedUserId, |
1021 ConvertJavaStringToUTF8(env, pref)); | 1023 ConvertJavaStringToUTF8(env, pref)); |
1022 } | 1024 } |
OLD | NEW |