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

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

Issue 1084423002: Split Camera and Mic into two permissions on the Site Details page (under Site Settings). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 5 years, 8 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
« no previous file with comments | « chrome/browser/android/preferences/pref_service_bridge.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 env, origin.substr(0, origin.size() - strlen(kHttpPortSuffix))); 84 env, origin.substr(0, origin.size() - strlen(kHttpPortSuffix)));
85 } else { 85 } else {
86 jorigin = ConvertUTF8ToJavaString(env, origin); 86 jorigin = ConvertUTF8ToJavaString(env, origin);
87 } 87 }
88 88
89 ScopedJavaLocalRef<jstring> jembedder; 89 ScopedJavaLocalRef<jstring> jembedder;
90 if (embedder != origin) 90 if (embedder != origin)
91 jembedder = ConvertUTF8ToJavaString(env, embedder); 91 jembedder = ConvertUTF8ToJavaString(env, embedder);
92 switch (content_type) { 92 switch (content_type) {
93 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: 93 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
94 Java_WebsitePreferenceBridge_insertMicrophoneInfoIntoList(
95 env, list, jorigin.obj(), jembedder.obj());
96 break;
94 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 97 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
95 Java_WebsitePreferenceBridge_insertVoiceAndVideoCaptureInfoIntoList( 98 Java_WebsitePreferenceBridge_insertCameraInfoIntoList(
96 env, list, jorigin.obj(), jembedder.obj()); 99 env, list, jorigin.obj(), jembedder.obj());
97 break; 100 break;
98 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 101 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
99 Java_WebsitePreferenceBridge_insertGeolocationInfoIntoList( 102 Java_WebsitePreferenceBridge_insertGeolocationInfoIntoList(
100 env, list, jorigin.obj(), jembedder.obj()); 103 env, list, jorigin.obj(), jembedder.obj());
101 break; 104 break;
102 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 105 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
103 Java_WebsitePreferenceBridge_insertMidiInfoIntoList( 106 Java_WebsitePreferenceBridge_insertMidiInfoIntoList(
104 env, list, jorigin.obj(), jembedder.obj()); 107 env, list, jorigin.obj(), jembedder.obj());
105 break; 108 break;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 DesktopNotificationProfileUtil::DenyPermission(profile, url); 273 DesktopNotificationProfileUtil::DenyPermission(profile, url);
271 setting = CONTENT_SETTING_BLOCK; 274 setting = CONTENT_SETTING_BLOCK;
272 break; 275 break;
273 default: 276 default:
274 NOTREACHED(); 277 NOTREACHED();
275 } 278 }
276 WebSiteSettingsUmaUtil::LogPermissionChange( 279 WebSiteSettingsUmaUtil::LogPermissionChange(
277 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, setting); 280 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, setting);
278 } 281 }
279 282
280 static void GetVoiceAndVideoCaptureOrigins(JNIEnv* env, 283 static void GetCameraOrigins(JNIEnv* env,
281 jclass clazz, 284 jclass clazz,
282 jobject list, 285 jobject list,
283 jboolean managedOnly) { 286 jboolean managedOnly) {
284 GetOrigins(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, list, managedOnly);
285 GetOrigins(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, list, managedOnly); 287 GetOrigins(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, list, managedOnly);
286 } 288 }
287 289
288 static jint GetVoiceCaptureSettingForOrigin(JNIEnv* env, jclass clazz, 290 static void GetMicrophoneOrigins(JNIEnv* env,
291 jclass clazz,
292 jobject list,
293 jboolean managedOnly) {
294 GetOrigins(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, list, managedOnly);
295 }
296
297 static jint GetMicrophoneSettingForOrigin(JNIEnv* env, jclass clazz,
289 jstring origin, jstring embedder) { 298 jstring origin, jstring embedder) {
290 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, 299 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
291 origin, embedder); 300 origin, embedder);
292 } 301 }
293 302
294 static jint GetVideoCaptureSettingForOrigin(JNIEnv* env, jclass clazz, 303 static jint GetCameraSettingForOrigin(JNIEnv* env, jclass clazz,
295 jstring origin, jstring embedder) { 304 jstring origin, jstring embedder) {
296 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, 305 return GetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
297 origin, embedder); 306 origin, embedder);
298 } 307 }
299 308
300 static void SetVoiceCaptureSettingForOrigin(JNIEnv* env, jclass clazz, 309 static void SetMicrophoneSettingForOrigin(JNIEnv* env, jclass clazz,
301 jstring origin, jstring embedder, jint value) { 310 jstring origin, jstring embedder, jint value) {
302 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, 311 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
303 origin, ContentSettingsPattern::Wildcard(), value); 312 origin, ContentSettingsPattern::Wildcard(), value);
304 } 313 }
305 314
306 static void SetVideoCaptureSettingForOrigin(JNIEnv* env, jclass clazz, 315 static void SetCameraSettingForOrigin(JNIEnv* env, jclass clazz,
307 jstring origin, jstring embedder, jint value) { 316 jstring origin, jstring embedder, jint value) {
308 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, 317 SetSettingForOrigin(env, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
309 origin, ContentSettingsPattern::Wildcard(), value); 318 origin, ContentSettingsPattern::Wildcard(), value);
310 } 319 }
311 320
312 static scoped_refptr<CookieSettings> GetCookieSettings() { 321 static scoped_refptr<CookieSettings> GetCookieSettings() {
313 Profile* profile = ProfileManager::GetActiveUserProfile(); 322 Profile* profile = ProfileManager::GetActiveUserProfile();
314 return CookieSettings::Factory::GetForProfile(profile); 323 return CookieSettings::Factory::GetForProfile(profile);
315 } 324 }
316 325
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 GURL url(ConvertJavaStringToUTF8(env, jorigin)); 696 GURL url(ConvertJavaStringToUTF8(env, jorigin));
688 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( 697 scoped_refptr<SiteDataDeleteHelper> site_data_deleter(
689 new SiteDataDeleteHelper(profile, url)); 698 new SiteDataDeleteHelper(profile, url));
690 site_data_deleter->Run(); 699 site_data_deleter->Run();
691 } 700 }
692 701
693 // Register native methods 702 // Register native methods
694 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { 703 bool RegisterWebsitePreferenceBridge(JNIEnv* env) {
695 return RegisterNativesImpl(env); 704 return RegisterNativesImpl(env);
696 } 705 }
OLDNEW
« no previous file with comments | « chrome/browser/android/preferences/pref_service_bridge.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698