| 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 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 RecordPermissionAction( | 300 RecordPermissionAction( |
| 301 request_, base::Bind(PermissionUmaUtil::PermissionDismissed)); | 301 request_, base::Bind(PermissionUmaUtil::PermissionDismissed)); |
| 302 RunCallback(old_audio_setting_, old_video_setting_, | 302 RunCallback(old_audio_setting_, old_video_setting_, |
| 303 content::MEDIA_DEVICE_PERMISSION_DISMISSED); | 303 content::MEDIA_DEVICE_PERMISSION_DISMISSED); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void MediaStreamDevicesController::RequestFinished() { | 306 void MediaStreamDevicesController::RequestFinished() { |
| 307 delete this; | 307 delete this; |
| 308 } | 308 } |
| 309 | 309 |
| 310 PermissionBubbleType MediaStreamDevicesController::GetPermissionBubbleType() |
| 311 const { |
| 312 return PermissionBubbleType::MEDIA_STREAM; |
| 313 } |
| 314 |
| 310 content::MediaStreamDevices MediaStreamDevicesController::GetDevices( | 315 content::MediaStreamDevices MediaStreamDevicesController::GetDevices( |
| 311 ContentSetting audio_setting, | 316 ContentSetting audio_setting, |
| 312 ContentSetting video_setting) { | 317 ContentSetting video_setting) { |
| 313 bool audio_allowed = audio_setting == CONTENT_SETTING_ALLOW; | 318 bool audio_allowed = audio_setting == CONTENT_SETTING_ALLOW; |
| 314 bool video_allowed = video_setting == CONTENT_SETTING_ALLOW; | 319 bool video_allowed = video_setting == CONTENT_SETTING_ALLOW; |
| 315 | 320 |
| 316 if (!audio_allowed && !video_allowed) | 321 if (!audio_allowed && !video_allowed) |
| 317 return content::MediaStreamDevices(); | 322 return content::MediaStreamDevices(); |
| 318 | 323 |
| 319 content::MediaStreamDevices devices; | 324 content::MediaStreamDevices devices; |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 if (android_permission_blocked) | 616 if (android_permission_blocked) |
| 612 return false; | 617 return false; |
| 613 | 618 |
| 614 // Don't approve device requests if the tab was hidden. | 619 // Don't approve device requests if the tab was hidden. |
| 615 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 620 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 616 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 621 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 617 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 622 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 618 #endif | 623 #endif |
| 619 return true; | 624 return true; |
| 620 } | 625 } |
| OLD | NEW |