 Chromium Code Reviews
 Chromium Code Reviews Issue 11896028:
  Add an location bar icon and a content settings bubble for media settings.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 11896028:
  Add an location bar icon and a content settings bubble for media settings.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/browser/media/media_stream_devices_controller.cc | 
| diff --git a/chrome/browser/media/media_stream_devices_controller.cc b/chrome/browser/media/media_stream_devices_controller.cc | 
| index 3ea05a66ad970ef0288bbd1427a2cdd8780c7e53..0d776b645bf213a1800d01a75f58fe6105687d79 100644 | 
| --- a/chrome/browser/media/media_stream_devices_controller.cc | 
| +++ b/chrome/browser/media/media_stream_devices_controller.cc | 
| @@ -7,6 +7,7 @@ | 
| #include "base/values.h" | 
| #include "chrome/browser/content_settings/content_settings_provider.h" | 
| #include "chrome/browser/content_settings/host_content_settings_map.h" | 
| +#include "chrome/browser/content_settings/tab_specific_content_settings.h" | 
| #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" | 
| #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry_factory.h" | 
| #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 
| @@ -21,10 +22,6 @@ | 
| using content::BrowserThread; | 
| -// TODO(xians): Remove this when the Omnibar UI has been completed. | 
| -// See http://crbug.com/167263 for more details. | 
| -#define ALLOW_STICKY_DENY 0 | 
| - | 
| namespace { | 
| bool HasAnyAvailableDevice() { | 
| @@ -42,9 +39,11 @@ bool HasAnyAvailableDevice() { | 
| MediaStreamDevicesController::MediaStreamDevicesController( | 
| Profile* profile, | 
| + TabSpecificContentSettings* content_settings, | 
| const content::MediaStreamRequest& request, | 
| const content::MediaResponseCallback& callback) | 
| : profile_(profile), | 
| + content_settings_(content_settings), | 
| request_(request), | 
| callback_(callback), | 
| has_audio_(content::IsAudioMediaType(request.audio_type) && | 
| @@ -121,6 +120,8 @@ const std::string& MediaStreamDevicesController::GetSecurityOriginSpec() const { | 
| } | 
| void MediaStreamDevicesController::Accept(bool update_content_setting) { | 
| + content_settings_->OnMediaStreamAccessed(); | 
| + // Get the default devices for the request. | 
| 
no longer working on chromium
2013/01/23 11:48:06
nit, add an empty line.
 
markusheintz_
2013/01/23 12:18:33
Done.
 | 
| content::MediaStreamDevices devices; | 
| if (has_audio_ || has_video_) { | 
| switch (request_.request_type) { | 
| @@ -143,7 +144,7 @@ void MediaStreamDevicesController::Accept(bool update_content_setting) { | 
| break; | 
| } | 
| - if (update_content_setting && IsSchemeSecure() && !devices.empty()) | 
| + if (update_content_setting && IsSchemeSecure() && !devices.empty()) | 
| SetPermission(true); | 
| } | 
| @@ -151,10 +152,13 @@ void MediaStreamDevicesController::Accept(bool update_content_setting) { | 
| } | 
| void MediaStreamDevicesController::Deny(bool update_content_setting) { | 
| -#if ALLOW_STICKY_DENY | 
| + // TODO(markusheintz): Replace CONTENT_SETTINGS_TYPE_MEDIA_STREAM with the | 
| + // appropriate new CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC and | 
| + // CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA. | 
| + content_settings_->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIASTREAM, | 
| + std::string()); | 
| if (update_content_setting) | 
| SetPermission(false); | 
| -#endif | 
| callback_.Run(content::MediaStreamDevices()); | 
| } | 
| @@ -200,7 +204,6 @@ bool MediaStreamDevicesController::IsRequestAllowedByDefault() const { | 
| } | 
| bool MediaStreamDevicesController::IsRequestBlockedByDefault() const { | 
| -#if ALLOW_STICKY_DENY | 
| if (has_audio_ && | 
| profile_->GetHostContentSettingsMap()->GetContentSetting( | 
| request_.security_origin, | 
| @@ -220,21 +223,17 @@ bool MediaStreamDevicesController::IsRequestBlockedByDefault() const { | 
| } | 
| return true; | 
| -#else | 
| - return false; | 
| -#endif | 
| } | 
| bool MediaStreamDevicesController::IsDefaultMediaAccessBlocked() const { | 
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| -#if ALLOW_STICKY_DENY | 
| + // TODO(markusheintz): Replace CONTENT_SETTINGS_TYPE_MEDIA_STREAM with the | 
| + // appropriate new CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC and | 
| + // CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA. | 
| ContentSetting current_setting = | 
| profile_->GetHostContentSettingsMap()->GetDefaultContentSetting( | 
| CONTENT_SETTINGS_TYPE_MEDIASTREAM, NULL); | 
| return (current_setting == CONTENT_SETTING_BLOCK); | 
| -#else | 
| - return false; | 
| -#endif | 
| } | 
| void MediaStreamDevicesController::HandleTapMediaRequest() { | 
| @@ -267,6 +266,9 @@ bool MediaStreamDevicesController::IsSchemeSecure() const { | 
| } | 
| bool MediaStreamDevicesController::ShouldAlwaysAllowOrigin() const { | 
| + // TODO(markusheintz): Replace CONTENT_SETTINGS_TYPE_MEDIA_STREAM with the | 
| + // appropriate new CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC and | 
| + // CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA. | 
| return profile_->GetHostContentSettingsMap()->ShouldAllowAllContent( | 
| request_.security_origin, request_.security_origin, | 
| CONTENT_SETTINGS_TYPE_MEDIASTREAM); |