Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 2039803002: Unregister Images, Plugins and Mouselock content settings on android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@only_register_platform_used_contentsettingtypes
Patch Set: nit change in comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1146
1150 return ConvertJavaStringToUTF8(android_permission); 1147 return ConvertJavaStringToUTF8(android_permission);
1151 } 1148 }
1152 1149
1153 static void SetSupervisedUserId(JNIEnv* env, 1150 static void SetSupervisedUserId(JNIEnv* env,
1154 const JavaParamRef<jobject>& obj, 1151 const JavaParamRef<jobject>& obj,
1155 const JavaParamRef<jstring>& pref) { 1152 const JavaParamRef<jstring>& pref) {
1156 GetPrefService()->SetString(prefs::kSupervisedUserId, 1153 GetPrefService()->SetString(prefs::kSupervisedUserId,
1157 ConvertJavaStringToUTF8(env, pref)); 1154 ConvertJavaStringToUTF8(env, pref));
1158 } 1155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698