| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 static_cast<ContentSettingsType>(content_settings_type); | 149 static_cast<ContentSettingsType>(content_settings_type); |
| 150 return GetBooleanForContentSetting(type); | 150 return GetBooleanForContentSetting(type); |
| 151 } | 151 } |
| 152 | 152 |
| 153 static void SetContentSettingEnabled(JNIEnv* env, | 153 static void SetContentSettingEnabled(JNIEnv* env, |
| 154 const JavaParamRef<jobject>& obj, | 154 const JavaParamRef<jobject>& obj, |
| 155 int content_settings_type, | 155 int content_settings_type, |
| 156 jboolean allow) { | 156 jboolean allow) { |
| 157 // Before we migrate functions over to this central function, we must verify | 157 // Before we migrate functions over to this central function, we must verify |
| 158 // that the new category supports ALLOW/BLOCK pairs and, if not, handle them. | 158 // that the new category supports ALLOW/BLOCK pairs and, if not, handle them. |
| 159 // IMAGES is included to allow migrating the setting back for users who had | |
| 160 // disabled images in M44 (see https://crbug.com/505844). | |
| 161 // TODO(bauerb): Remove this when the migration code is removed. | |
| 162 DCHECK(content_settings_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || | 159 DCHECK(content_settings_type == CONTENT_SETTINGS_TYPE_JAVASCRIPT || |
| 163 content_settings_type == CONTENT_SETTINGS_TYPE_POPUPS || | 160 content_settings_type == CONTENT_SETTINGS_TYPE_POPUPS); |
| 164 content_settings_type == CONTENT_SETTINGS_TYPE_IMAGES); | 161 |
| 165 HostContentSettingsMap* host_content_settings_map = | 162 HostContentSettingsMap* host_content_settings_map = |
| 166 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); | 163 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
| 167 host_content_settings_map->SetDefaultContentSetting( | 164 host_content_settings_map->SetDefaultContentSetting( |
| 168 static_cast<ContentSettingsType>(content_settings_type), | 165 static_cast<ContentSettingsType>(content_settings_type), |
| 169 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); | 166 allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); |
| 170 } | 167 } |
| 171 | 168 |
| 172 static void SetContentSettingForPattern(JNIEnv* env, | 169 static void SetContentSettingForPattern(JNIEnv* env, |
| 173 const JavaParamRef<jobject>& obj, | 170 const JavaParamRef<jobject>& obj, |
| 174 int content_settings_type, | 171 int content_settings_type, |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 | 1140 |
| 1144 return ConvertJavaStringToUTF8(android_permission); | 1141 return ConvertJavaStringToUTF8(android_permission); |
| 1145 } | 1142 } |
| 1146 | 1143 |
| 1147 static void SetSupervisedUserId(JNIEnv* env, | 1144 static void SetSupervisedUserId(JNIEnv* env, |
| 1148 const JavaParamRef<jobject>& obj, | 1145 const JavaParamRef<jobject>& obj, |
| 1149 const JavaParamRef<jstring>& pref) { | 1146 const JavaParamRef<jstring>& pref) { |
| 1150 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1147 GetPrefService()->SetString(prefs::kSupervisedUserId, |
| 1151 ConvertJavaStringToUTF8(env, pref)); | 1148 ConvertJavaStringToUTF8(env, pref)); |
| 1152 } | 1149 } |
| OLD | NEW |