Chromium Code Reviews| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 delete this; | 284 delete this; |
| 285 } | 285 } |
| 286 | 286 |
| 287 PermissionRequestType | 287 PermissionRequestType |
| 288 MediaStreamDevicesController::Request::GetPermissionRequestType() const { | 288 MediaStreamDevicesController::Request::GetPermissionRequestType() const { |
| 289 return PermissionRequestType::MEDIA_STREAM; | 289 return PermissionRequestType::MEDIA_STREAM; |
| 290 } | 290 } |
| 291 | 291 |
| 292 bool MediaStreamDevicesController::Request::ShouldShowPersistenceToggle() | 292 bool MediaStreamDevicesController::Request::ShouldShowPersistenceToggle() |
| 293 const { | 293 const { |
| 294 return PermissionUtil::ShouldShowPersistenceToggle(); | 294 if (IsAskingForVideo()) |
| 295 return PermissionUtil::ShouldShowPersistenceToggle( | |
| 296 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | |
|
raymes
2017/05/30 03:58:58
nit: {} for multi-line if
| |
| 297 return PermissionUtil::ShouldShowPersistenceToggle( | |
| 298 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | |
|
raymes
2017/05/30 03:58:58
If we're asking for both mic and camera, should we
Timothy Loh
2017/05/30 05:52:43
I changed this to just check CAMERA and added a co
| |
| 295 } | 299 } |
| 296 | 300 |
| 297 // Implementation of PermissionPromptDelegate which actually shows a permission | 301 // Implementation of PermissionPromptDelegate which actually shows a permission |
| 298 // prompt. | 302 // prompt. |
| 299 class MediaStreamDevicesController::PermissionPromptDelegateImpl | 303 class MediaStreamDevicesController::PermissionPromptDelegateImpl |
| 300 : public MediaStreamDevicesController::PermissionPromptDelegate { | 304 : public MediaStreamDevicesController::PermissionPromptDelegate { |
| 301 public: | 305 public: |
| 302 void ShowPrompt( | 306 void ShowPrompt( |
| 303 bool user_gesture, | 307 bool user_gesture, |
| 304 content::WebContents* web_contents, | 308 content::WebContents* web_contents, |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 } | 774 } |
| 771 } | 775 } |
| 772 | 776 |
| 773 // Don't approve device requests if the tab was hidden. | 777 // Don't approve device requests if the tab was hidden. |
| 774 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 778 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 775 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 779 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 776 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 780 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 777 #endif | 781 #endif |
| 778 return true; | 782 return true; |
| 779 } | 783 } |
| OLD | NEW |