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

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

Issue 1432573002: Adding <keygen> Content Setting (Android UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@keygen_ui
Patch Set: Trying tested code. Created 4 years, 11 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 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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
16 #include "chrome/browser/browsing_data/cookies_tree_model.h" 16 #include "chrome/browser/browsing_data/cookies_tree_model.h"
17 #include "chrome/browser/browsing_data/local_data_container.h" 17 #include "chrome/browser/browsing_data/local_data_container.h"
18 #include "chrome/browser/content_settings/cookie_settings_factory.h" 18 #include "chrome/browser/content_settings/cookie_settings_factory.h"
19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 19 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
20 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
20 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" 21 #include "chrome/browser/content_settings/web_site_settings_uma_util.h"
21 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 22 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_manager.h" 24 #include "chrome/browser/profiles/profile_manager.h"
24 #include "components/content_settings/core/browser/cookie_settings.h" 25 #include "components/content_settings/core/browser/cookie_settings.h"
25 #include "components/content_settings/core/browser/host_content_settings_map.h" 26 #include "components/content_settings/core/browser/host_content_settings_map.h"
26 #include "content/public/browser/browser_thread.h" 27 #include "content/public/browser/browser_thread.h"
27 #include "content/public/browser/storage_partition.h" 28 #include "content/public/browser/storage_partition.h"
28 #include "jni/WebsitePreferenceBridge_jni.h" 29 #include "jni/WebsitePreferenceBridge_jni.h"
29 #include "storage/browser/quota/quota_client.h" 30 #include "storage/browser/quota/quota_client.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 const JavaParamRef<jstring>& origin, 199 const JavaParamRef<jstring>& origin,
199 const JavaParamRef<jstring>& embedder, 200 const JavaParamRef<jstring>& embedder,
200 jint value, 201 jint value,
201 jboolean is_incognito) { 202 jboolean is_incognito) {
202 GURL embedder_url(ConvertJavaStringToUTF8(env, embedder)); 203 GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
203 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin, 204 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_GEOLOCATION, origin,
204 ContentSettingsPattern::FromURLNoWildcard(embedder_url), 205 ContentSettingsPattern::FromURLNoWildcard(embedder_url),
205 (ContentSetting) value, is_incognito); 206 (ContentSetting) value, is_incognito);
206 } 207 }
207 208
209 static void GetKeygenOrigins(JNIEnv* env,
210 const JavaParamRef<jclass>& clazz,
211 const JavaParamRef<jobject>& list) {
212 GetOrigins(env, CONTENT_SETTINGS_TYPE_KEYGEN,
213 &Java_WebsitePreferenceBridge_insertKeygenInfoIntoList, list,
214 false);
215 }
216
217 static jint GetKeygenSettingForOrigin(JNIEnv* env,
218 const JavaParamRef<jclass>& clazz,
219 const JavaParamRef<jstring>& origin,
220 const JavaParamRef<jstring>& embedder,
221 jboolean is_incognito) {
222 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin,
223 embedder, is_incognito);
224 }
225
226 static void SetKeygenSettingForOrigin(JNIEnv* env,
227 const JavaParamRef<jclass>& clazz,
228 const JavaParamRef<jstring>& origin,
229 const JavaParamRef<jstring>& embedder,
230 jint value,
231 jboolean is_incognito) {
232 GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
233 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_KEYGEN, origin,
234 ContentSettingsPattern::FromURLNoWildcard(embedder_url),
235 (ContentSetting) value, is_incognito);
236 }
237
238 static jboolean GetKeygenBlocked(JNIEnv* env,
239 const JavaParamRef<jclass>& clazz,
240 const JavaParamRef<jobject>& java_web_contents) {
241 content::WebContents* web_contents =
242 content::WebContents::FromJavaWebContents(java_web_contents);
243 return TabSpecificContentSettings::FromWebContents(
244 web_contents)->IsContentBlocked(CONTENT_SETTINGS_TYPE_KEYGEN);
245 }
246
208 static void GetMidiOrigins(JNIEnv* env, 247 static void GetMidiOrigins(JNIEnv* env,
209 const JavaParamRef<jclass>& clazz, 248 const JavaParamRef<jclass>& clazz,
210 const JavaParamRef<jobject>& list) { 249 const JavaParamRef<jobject>& list) {
211 GetOrigins(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX, 250 GetOrigins(env, CONTENT_SETTINGS_TYPE_MIDI_SYSEX,
212 &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false); 251 &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false);
213 } 252 }
214 253
215 static jint GetMidiSettingForOrigin(JNIEnv* env, 254 static jint GetMidiSettingForOrigin(JNIEnv* env,
216 const JavaParamRef<jclass>& clazz, 255 const JavaParamRef<jclass>& clazz,
217 const JavaParamRef<jstring>& origin, 256 const JavaParamRef<jstring>& origin,
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 GURL url(ConvertJavaStringToUTF8(env, jorigin)); 823 GURL url(ConvertJavaStringToUTF8(env, jorigin));
785 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( 824 scoped_refptr<SiteDataDeleteHelper> site_data_deleter(
786 new SiteDataDeleteHelper(profile, url)); 825 new SiteDataDeleteHelper(profile, url));
787 site_data_deleter->Run(); 826 site_data_deleter->Run();
788 } 827 }
789 828
790 // Register native methods 829 // Register native methods
791 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { 830 bool RegisterWebsitePreferenceBridge(JNIEnv* env) {
792 return RegisterNativesImpl(env); 831 return RegisterNativesImpl(env);
793 } 832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698