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

Side by Side Diff: chrome/browser/media/media_stream_devices_controller.cc

Issue 12079097: Introduce PrefRegistrySyncable, simplifying PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again; base::File changes conflicted. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/media/media_stream_devices_controller.h" 5 #include "chrome/browser/media/media_stream_devices_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/content_settings/content_settings_provider.h" 9 #include "chrome/browser/content_settings/content_settings_provider.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
12 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" 12 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
13 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory .h" 13 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory .h"
14 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 14 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
15 #include "chrome/browser/prefs/pref_registry_syncable.h"
16 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" 17 #include "chrome/browser/prefs/scoped_user_pref_update.h"
16 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
18 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/content_settings.h" 21 #include "chrome/common/content_settings.h"
20 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
22 #include "content/public/common/media_stream_request.h" 24 #include "content/public/common/media_stream_request.h"
23 25
24 using content::BrowserThread; 26 using content::BrowserThread;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 if (webcam_requested_ && 61 if (webcam_requested_ &&
60 GetDevicePolicy(prefs::kVideoCaptureAllowed) == ALWAYS_DENY) { 62 GetDevicePolicy(prefs::kVideoCaptureAllowed) == ALWAYS_DENY) {
61 webcam_requested_ = false; 63 webcam_requested_ = false;
62 } 64 }
63 } 65 }
64 66
65 MediaStreamDevicesController::~MediaStreamDevicesController() {} 67 MediaStreamDevicesController::~MediaStreamDevicesController() {}
66 68
67 // static 69 // static
68 void MediaStreamDevicesController::RegisterUserPrefs( 70 void MediaStreamDevicesController::RegisterUserPrefs(
69 PrefServiceSyncable* prefs) { 71 PrefRegistrySyncable* prefs) {
70 prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed, 72 prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed,
71 true, 73 true,
72 PrefServiceSyncable::UNSYNCABLE_PREF); 74 PrefRegistrySyncable::UNSYNCABLE_PREF);
73 prefs->RegisterBooleanPref(prefs::kAudioCaptureAllowed, 75 prefs->RegisterBooleanPref(prefs::kAudioCaptureAllowed,
74 true, 76 true,
75 PrefServiceSyncable::UNSYNCABLE_PREF); 77 PrefRegistrySyncable::UNSYNCABLE_PREF);
76 } 78 }
77 79
78 80
79 bool MediaStreamDevicesController::DismissInfoBarAndTakeActionOnSettings() { 81 bool MediaStreamDevicesController::DismissInfoBarAndTakeActionOnSettings() {
80 // If this is a no UI check for policies only go straight to accept - policy 82 // If this is a no UI check for policies only go straight to accept - policy
81 // check will be done automatically on the way. 83 // check will be done automatically on the way.
82 if (request_.request_type == content::MEDIA_OPEN_DEVICE) { 84 if (request_.request_type == content::MEDIA_OPEN_DEVICE) {
83 Accept(false); 85 Accept(false);
84 return true; 86 return true;
85 } 87 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (update_content_setting) 179 if (update_content_setting)
178 SetPermission(false); 180 SetPermission(false);
179 181
180 callback_.Run(content::MediaStreamDevices()); 182 callback_.Run(content::MediaStreamDevices());
181 } 183 }
182 184
183 MediaStreamDevicesController::DevicePolicy 185 MediaStreamDevicesController::DevicePolicy
184 MediaStreamDevicesController::GetDevicePolicy(const char* policy_name) const { 186 MediaStreamDevicesController::GetDevicePolicy(const char* policy_name) const {
185 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 187 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
186 188
187 PrefServiceSyncable* pref = profile_->GetPrefs(); 189 PrefService* prefs = profile_->GetPrefs();
188 if (!pref->IsManagedPreference(policy_name)) 190 if (!prefs->IsManagedPreference(policy_name))
189 return POLICY_NOT_SET; 191 return POLICY_NOT_SET;
190 192
191 return pref->GetBoolean(policy_name) ? ALWAYS_ALLOW : ALWAYS_DENY; 193 return prefs->GetBoolean(policy_name) ? ALWAYS_ALLOW : ALWAYS_DENY;
192 } 194 }
193 195
194 bool MediaStreamDevicesController::IsRequestAllowedByDefault() const { 196 bool MediaStreamDevicesController::IsRequestAllowedByDefault() const {
195 // The request from internal objects like chrome://URLs is always allowed. 197 // The request from internal objects like chrome://URLs is always allowed.
196 if (ShouldAlwaysAllowOrigin()) 198 if (ShouldAlwaysAllowOrigin())
197 return true; 199 return true;
198 200
199 struct { 201 struct {
200 bool has_capability; 202 bool has_capability;
201 const char* policy_name; 203 const char* policy_name;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 325 }
324 if (webcam_requested_) { 326 if (webcam_requested_) {
325 profile_->GetHostContentSettingsMap()->SetContentSetting( 327 profile_->GetHostContentSettingsMap()->SetContentSetting(
326 primary_pattern, 328 primary_pattern,
327 ContentSettingsPattern::Wildcard(), 329 ContentSettingsPattern::Wildcard(),
328 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, 330 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA,
329 std::string(), 331 std::string(),
330 content_setting); 332 content_setting);
331 } 333 }
332 } 334 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_devices_controller.h ('k') | chrome/browser/media_gallery/media_galleries_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698