| 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/webrtc/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 get_default_video_device, &devices); | 416 get_default_video_device, &devices); |
| 417 } | 417 } |
| 418 break; | 418 break; |
| 419 } | 419 } |
| 420 case content::MEDIA_DEVICE_ACCESS: { | 420 case content::MEDIA_DEVICE_ACCESS: { |
| 421 // Get the default devices for the request. | 421 // Get the default devices for the request. |
| 422 MediaCaptureDevicesDispatcher::GetInstance()->GetDefaultDevicesForProfile( | 422 MediaCaptureDevicesDispatcher::GetInstance()->GetDefaultDevicesForProfile( |
| 423 profile_, audio_allowed, video_allowed, &devices); | 423 profile_, audio_allowed, video_allowed, &devices); |
| 424 break; | 424 break; |
| 425 } | 425 } |
| 426 case content::MEDIA_ENUMERATE_DEVICES: { | |
| 427 // Do nothing. | |
| 428 NOTREACHED(); | |
| 429 break; | |
| 430 } | |
| 431 } // switch | 426 } // switch |
| 432 | 427 |
| 433 if (audio_allowed) { | 428 if (audio_allowed) { |
| 434 HostContentSettingsMapFactory::GetForProfile(profile_) | 429 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 435 ->UpdateLastUsageByPattern( | 430 ->UpdateLastUsageByPattern( |
| 436 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin), | 431 ContentSettingsPattern::FromURLNoWildcard(request_.security_origin), |
| 437 ContentSettingsPattern::Wildcard(), | 432 ContentSettingsPattern::Wildcard(), |
| 438 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 433 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 439 } | 434 } |
| 440 if (video_allowed) { | 435 if (video_allowed) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 if (android_permission_blocked) | 623 if (android_permission_blocked) |
| 629 return false; | 624 return false; |
| 630 | 625 |
| 631 // Don't approve device requests if the tab was hidden. | 626 // Don't approve device requests if the tab was hidden. |
| 632 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 627 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 633 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 628 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 634 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 629 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 635 #endif | 630 #endif |
| 636 return true; | 631 return true; |
| 637 } | 632 } |
| OLD | NEW |