| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 JNIEnv* env, | 197 JNIEnv* env, |
| 198 const JavaParamRef<jclass>& clazz, | 198 const JavaParamRef<jclass>& clazz, |
| 199 const JavaParamRef<jstring>& origin, | 199 const JavaParamRef<jstring>& origin, |
| 200 const JavaParamRef<jstring>& embedder, | 200 const JavaParamRef<jstring>& embedder, |
| 201 jint value, | 201 jint value, |
| 202 jboolean is_incognito) { | 202 jboolean is_incognito) { |
| 203 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin, embedder, | 203 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin, embedder, |
| 204 static_cast<ContentSetting>(value), is_incognito); | 204 static_cast<ContentSetting>(value), is_incognito); |
| 205 } | 205 } |
| 206 | 206 |
| 207 static void GetKeygenOrigins(JNIEnv* env, | |
| 208 const JavaParamRef<jclass>& clazz, | |
| 209 const JavaParamRef<jobject>& list) { | |
| 210 GetOrigins(env, CONTENT_SETTINGS_TYPE_KEYGEN, | |
| 211 &Java_WebsitePreferenceBridge_insertKeygenInfoIntoList, list, | |
| 212 false); | |
| 213 } | |
| 214 | |
| 215 static jint GetKeygenSettingForOrigin(JNIEnv* env, | |
| 216 const JavaParamRef<jclass>& clazz, | |
| 217 const JavaParamRef<jstring>& origin, | |
| 218 const JavaParamRef<jstring>& embedder, | |
| 219 jboolean is_incognito) { | |
| 220 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin, | |
| 221 embedder, is_incognito); | |
| 222 } | |
| 223 | |
| 224 static void SetKeygenSettingForOrigin(JNIEnv* env, | |
| 225 const JavaParamRef<jclass>& clazz, | |
| 226 const JavaParamRef<jstring>& origin, | |
| 227 jint value, | |
| 228 jboolean is_incognito) { | |
| 229 // Here 'nullptr' indicates that keygen uses wildcard for embedder. | |
| 230 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin, nullptr, | |
| 231 static_cast<ContentSetting>(value), is_incognito); | |
| 232 } | |
| 233 | |
| 234 static jboolean GetKeygenBlocked(JNIEnv* env, | |
| 235 const JavaParamRef<jclass>& clazz, | |
| 236 const JavaParamRef<jobject>& java_web_contents) { | |
| 237 content::WebContents* web_contents = | |
| 238 content::WebContents::FromJavaWebContents(java_web_contents); | |
| 239 return TabSpecificContentSettings::FromWebContents( | |
| 240 web_contents)->IsContentBlocked(CONTENT_SETTINGS_TYPE_KEYGEN); | |
| 241 } | |
| 242 | |
| 243 static void GetMidiOrigins(JNIEnv* env, | 207 static void GetMidiOrigins(JNIEnv* env, |
| 244 const JavaParamRef<jclass>& clazz, | 208 const JavaParamRef<jclass>& clazz, |
| 245 const JavaParamRef<jobject>& list) { | 209 const JavaParamRef<jobject>& list) { |
| 246 GetOrigins(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, | 210 GetOrigins(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, |
| 247 &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false); | 211 &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false); |
| 248 } | 212 } |
| 249 | 213 |
| 250 static jint GetMidiSettingForOrigin(JNIEnv* env, | 214 static jint GetMidiSettingForOrigin(JNIEnv* env, |
| 251 const JavaParamRef<jclass>& clazz, | 215 const JavaParamRef<jclass>& clazz, |
| 252 const JavaParamRef<jstring>& origin, | 216 const JavaParamRef<jstring>& origin, |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 GURL url(ConvertJavaStringToUTF8(env, jorigin)); | 729 GURL url(ConvertJavaStringToUTF8(env, jorigin)); |
| 766 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( | 730 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( |
| 767 new SiteDataDeleteHelper(profile, url)); | 731 new SiteDataDeleteHelper(profile, url)); |
| 768 site_data_deleter->Run(); | 732 site_data_deleter->Run(); |
| 769 } | 733 } |
| 770 | 734 |
| 771 // Register native methods | 735 // Register native methods |
| 772 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { | 736 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { |
| 773 return RegisterNativesImpl(env); | 737 return RegisterNativesImpl(env); |
| 774 } | 738 } |
| OLD | NEW |