| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // If either or both audio and video devices were requested but not | 403 // If either or both audio and video devices were requested but not |
| 404 // specified by id, get the default devices. | 404 // specified by id, get the default devices. |
| 405 if (get_default_audio_device || get_default_video_device) { | 405 if (get_default_audio_device || get_default_video_device) { |
| 406 MediaCaptureDevicesDispatcher::GetInstance()-> | 406 MediaCaptureDevicesDispatcher::GetInstance()-> |
| 407 GetDefaultDevicesForProfile(profile_, | 407 GetDefaultDevicesForProfile(profile_, |
| 408 get_default_audio_device, | 408 get_default_audio_device, |
| 409 get_default_video_device, | 409 get_default_video_device, |
| 410 &devices); | 410 &devices); |
| 411 } | 411 } |
| 412 | 412 |
| 413 // Tag this navigation entry with the granted permissions. | 413 // For pages accessed via http (not https), tag this navigation entry |
| 414 // This avoids repeated prompts for requests accessed via http. | 414 // with the granted permissions. This avoids repeated prompts for |
| 415 content::NavigationEntry* navigation_entry = | 415 // device access. |
| 416 web_contents_->GetController().GetVisibleEntry(); | 416 if (!IsSchemeSecure()) { |
| 417 if (navigation_entry) { | 417 content::NavigationEntry* navigation_entry = |
| 418 SetMediaPermissionsForNavigationEntry( | 418 web_contents_->GetController().GetVisibleEntry(); |
| 419 navigation_entry, request_, audio_allowed, video_allowed); | 419 if (navigation_entry) { |
| 420 SetMediaPermissionsForNavigationEntry( |
| 421 navigation_entry, request_, audio_allowed, video_allowed); |
| 422 } |
| 420 } | 423 } |
| 421 break; | 424 break; |
| 422 } | 425 } |
| 423 case content::MEDIA_DEVICE_ACCESS: { | 426 case content::MEDIA_DEVICE_ACCESS: { |
| 424 // Get the default devices for the request. | 427 // Get the default devices for the request. |
| 425 MediaCaptureDevicesDispatcher::GetInstance()-> | 428 MediaCaptureDevicesDispatcher::GetInstance()-> |
| 426 GetDefaultDevicesForProfile(profile_, | 429 GetDefaultDevicesForProfile(profile_, |
| 427 audio_allowed, | 430 audio_allowed, |
| 428 video_allowed, | 431 video_allowed, |
| 429 &devices); | 432 &devices); |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 it->second.permission == MEDIA_ALLOWED); | 766 it->second.permission == MEDIA_ALLOWED); |
| 764 } | 767 } |
| 765 | 768 |
| 766 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() | 769 bool MediaStreamDevicesController::IsDeviceVideoCaptureRequestedAndAllowed() |
| 767 const { | 770 const { |
| 768 MediaStreamTypeSettingsMap::const_iterator it = | 771 MediaStreamTypeSettingsMap::const_iterator it = |
| 769 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); | 772 request_permissions_.find(content::MEDIA_DEVICE_VIDEO_CAPTURE); |
| 770 return (it != request_permissions_.end() && | 773 return (it != request_permissions_.end() && |
| 771 it->second.permission == MEDIA_ALLOWED); | 774 it->second.permission == MEDIA_ALLOWED); |
| 772 } | 775 } |
| OLD | NEW |