OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/website_preference_bridge.h" | 5 #include "chrome/browser/android/preferences/website_preference_bridge.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 JNIEnv* env, | 206 JNIEnv* env, |
207 const JavaParamRef<jclass>& clazz, | 207 const JavaParamRef<jclass>& clazz, |
208 const JavaParamRef<jstring>& origin, | 208 const JavaParamRef<jstring>& origin, |
209 const JavaParamRef<jstring>& embedder, | 209 const JavaParamRef<jstring>& embedder, |
210 jint value, | 210 jint value, |
211 jboolean is_incognito) { | 211 jboolean is_incognito) { |
212 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin, embedder, | 212 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin, embedder, |
213 static_cast<ContentSetting>(value), is_incognito); | 213 static_cast<ContentSetting>(value), is_incognito); |
214 } | 214 } |
215 | 215 |
216 static void GetKeygenOrigins(JNIEnv* env, | |
217 const JavaParamRef<jclass>& clazz, | |
218 const JavaParamRef<jobject>& list) { | |
219 GetOrigins(env, CONTENT_SETTINGS_TYPE_KEYGEN, | |
220 &Java_WebsitePreferenceBridge_insertKeygenInfoIntoList, list, | |
221 false); | |
222 } | |
223 | |
224 static jint GetKeygenSettingForOrigin(JNIEnv* env, | |
225 const JavaParamRef<jclass>& clazz, | |
226 const JavaParamRef<jstring>& origin, | |
227 const JavaParamRef<jstring>& embedder, | |
228 jboolean is_incognito) { | |
229 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin, | |
230 embedder, is_incognito); | |
231 } | |
232 | |
233 static void SetKeygenSettingForOrigin(JNIEnv* env, | |
234 const JavaParamRef<jclass>& clazz, | |
235 const JavaParamRef<jstring>& origin, | |
236 jint value, | |
237 jboolean is_incognito) { | |
238 // Here 'nullptr' indicates that keygen uses wildcard for embedder. | |
239 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin, nullptr, | |
240 static_cast<ContentSetting>(value), is_incognito); | |
241 } | |
242 | |
243 static jboolean GetKeygenBlocked(JNIEnv* env, | |
244 const JavaParamRef<jclass>& clazz, | |
245 const JavaParamRef<jobject>& java_web_contents) { | |
246 content::WebContents* web_contents = | |
247 content::WebContents::FromJavaWebContents(java_web_contents); | |
248 return TabSpecificContentSettings::FromWebContents( | |
249 web_contents)->IsContentBlocked(CONTENT_SETTINGS_TYPE_KEYGEN); | |
250 } | |
251 | |
252 static void GetMidiOrigins(JNIEnv* env, | 216 static void GetMidiOrigins(JNIEnv* env, |
253 const JavaParamRef<jclass>& clazz, | 217 const JavaParamRef<jclass>& clazz, |
254 const JavaParamRef<jobject>& list) { | 218 const JavaParamRef<jobject>& list) { |
255 GetOrigins(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, | 219 GetOrigins(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, |
256 &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false); | 220 &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false); |
257 } | 221 } |
258 | 222 |
259 static jint GetMidiSettingForOrigin(JNIEnv* env, | 223 static jint GetMidiSettingForOrigin(JNIEnv* env, |
260 const JavaParamRef<jclass>& clazz, | 224 const JavaParamRef<jclass>& clazz, |
261 const JavaParamRef<jstring>& origin, | 225 const JavaParamRef<jstring>& origin, |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 ->ClearSettingsForOneTypeWithPredicate( | 750 ->ClearSettingsForOneTypeWithPredicate( |
787 CONTENT_SETTINGS_TYPE_APP_BANNER, | 751 CONTENT_SETTINGS_TYPE_APP_BANNER, |
788 base::Bind(&ForwardPrimaryPatternCallback, | 752 base::Bind(&ForwardPrimaryPatternCallback, |
789 builder.BuildWebsiteSettingsPatternMatchesFilter())); | 753 builder.BuildWebsiteSettingsPatternMatchesFilter())); |
790 } | 754 } |
791 | 755 |
792 // Register native methods | 756 // Register native methods |
793 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { | 757 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { |
794 return RegisterNativesImpl(env); | 758 return RegisterNativesImpl(env); |
795 } | 759 } |
OLD | NEW |