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 <map> | 7 #include <map> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
10 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/prefs/scoped_user_pref_update.h" | 13 #include "base/prefs/scoped_user_pref_update.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
16 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 17 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
17 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 18 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // at this point we still report a failure. | 448 // at this point we still report a failure. |
448 request_result = content::MEDIA_DEVICE_NO_HARDWARE; | 449 request_result = content::MEDIA_DEVICE_NO_HARDWARE; |
449 } | 450 } |
450 | 451 |
451 scoped_ptr<content::MediaStreamUI> ui; | 452 scoped_ptr<content::MediaStreamUI> ui; |
452 if (!devices.empty()) { | 453 if (!devices.empty()) { |
453 ui = MediaCaptureDevicesDispatcher::GetInstance() | 454 ui = MediaCaptureDevicesDispatcher::GetInstance() |
454 ->GetMediaStreamCaptureIndicator() | 455 ->GetMediaStreamCaptureIndicator() |
455 ->RegisterMediaStream(web_contents_, devices); | 456 ->RegisterMediaStream(web_contents_, devices); |
456 } | 457 } |
457 base::ResetAndReturn(&callback_).Run(devices, request_result, ui.Pass()); | 458 base::ResetAndReturn(&callback_).Run(devices, request_result, std::move(ui)); |
458 } | 459 } |
459 | 460 |
460 void MediaStreamDevicesController::StorePermission( | 461 void MediaStreamDevicesController::StorePermission( |
461 ContentSetting new_audio_setting, | 462 ContentSetting new_audio_setting, |
462 ContentSetting new_video_setting) const { | 463 ContentSetting new_video_setting) const { |
463 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 464 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
464 ContentSettingsPattern primary_pattern = | 465 ContentSettingsPattern primary_pattern = |
465 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin); | 466 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin); |
466 | 467 |
467 bool is_pepper_request = | 468 bool is_pepper_request = |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 if (android_permission_blocked) | 615 if (android_permission_blocked) |
615 return false; | 616 return false; |
616 | 617 |
617 // Don't approve device requests if the tab was hidden. | 618 // Don't approve device requests if the tab was hidden. |
618 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 619 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
619 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 620 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
620 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 621 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
621 #endif | 622 #endif |
622 return true; | 623 return true; |
623 } | 624 } |
OLD | NEW |