OLD | NEW |
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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 content::MEDIA_DEVICE_VIDEO_CAPTURE, | 146 content::MEDIA_DEVICE_VIDEO_CAPTURE, |
147 MediaStreamTypeSettings(MEDIA_ALLOWED, | 147 MediaStreamTypeSettings(MEDIA_ALLOWED, |
148 request.requested_video_device_id))); | 148 request.requested_video_device_id))); |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 MediaStreamDevicesController::~MediaStreamDevicesController() { | 153 MediaStreamDevicesController::~MediaStreamDevicesController() { |
154 if (!callback_.is_null()) { | 154 if (!callback_.is_null()) { |
155 callback_.Run(content::MediaStreamDevices(), | 155 callback_.Run(content::MediaStreamDevices(), |
156 content::MEDIA_DEVICE_INVALID_STATE, | 156 content::MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, |
157 scoped_ptr<content::MediaStreamUI>()); | 157 scoped_ptr<content::MediaStreamUI>()); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 // static | 161 // static |
162 void MediaStreamDevicesController::RegisterProfilePrefs( | 162 void MediaStreamDevicesController::RegisterProfilePrefs( |
163 user_prefs::PrefRegistrySyncable* prefs) { | 163 user_prefs::PrefRegistrySyncable* prefs) { |
164 prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed, | 164 prefs->RegisterBooleanPref(prefs::kVideoCaptureAllowed, |
165 true, | 165 true, |
166 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 166 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 } | 617 } |
618 | 618 |
619 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { | 619 bool MediaStreamDevicesController::IsCaptureDeviceRequestAllowed() const { |
620 #if defined(OS_ANDROID) | 620 #if defined(OS_ANDROID) |
621 // Don't approve device requests if the tab was hidden. | 621 // Don't approve device requests if the tab was hidden. |
622 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 622 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
623 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 623 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
624 #endif | 624 #endif |
625 return true; | 625 return true; |
626 } | 626 } |
OLD | NEW |