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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 // TODO(raymes): We currently set the content permission for non-https | 339 // TODO(raymes): We currently set the content permission for non-https |
340 // websites for Pepper requests as well. This is temporary and should be | 340 // websites for Pepper requests as well. This is temporary and should be |
341 // removed. | 341 // removed. |
342 if (update_content_setting) { | 342 if (update_content_setting) { |
343 if ((IsSchemeSecure() && !devices.empty()) || | 343 if ((IsSchemeSecure() && !devices.empty()) || |
344 request_.request_type == content::MEDIA_OPEN_DEVICE) { | 344 request_.request_type == content::MEDIA_OPEN_DEVICE) { |
345 SetPermission(true); | 345 SetPermission(true); |
346 } | 346 } |
347 } | 347 } |
| 348 |
| 349 if (audio_allowed) { |
| 350 profile_->GetHostContentSettingsMap()->UpdateLastUsageByPattern( |
| 351 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin), |
| 352 ContentSettingsPattern::Wildcard(), |
| 353 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 354 } |
| 355 if (video_allowed) { |
| 356 profile_->GetHostContentSettingsMap()->UpdateLastUsageByPattern( |
| 357 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin), |
| 358 ContentSettingsPattern::Wildcard(), |
| 359 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 360 } |
348 } | 361 } |
349 | 362 |
350 scoped_ptr<content::MediaStreamUI> ui; | 363 scoped_ptr<content::MediaStreamUI> ui; |
351 if (!devices.empty()) { | 364 if (!devices.empty()) { |
352 ui = MediaCaptureDevicesDispatcher::GetInstance()-> | 365 ui = MediaCaptureDevicesDispatcher::GetInstance()-> |
353 GetMediaStreamCaptureIndicator()->RegisterMediaStream( | 366 GetMediaStreamCaptureIndicator()->RegisterMediaStream( |
354 web_contents_, devices); | 367 web_contents_, devices); |
355 } | 368 } |
356 content::MediaResponseCallback cb = callback_; | 369 content::MediaResponseCallback cb = callback_; |
357 callback_.Reset(); | 370 callback_.Reset(); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 it->second.permission == MEDIA_ALLOWED); | 666 it->second.permission == MEDIA_ALLOWED); |
654 } | 667 } |
655 | 668 |
656 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() | 669 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() |
657 const { | 670 const { |
658 MediaStreamTypeSettingsMap::const_iterator it = | 671 MediaStreamTypeSettingsMap::const_iterator it = |
659 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); | 672 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); |
660 return (it != request_permissions_.end() && | 673 return (it != request_permissions_.end() && |
661 it->second.permission == MEDIA_ALLOWED); | 674 it->second.permission == MEDIA_ALLOWED); |
662 } | 675 } |
OLD | NEW |