| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 delete this; | 286 delete this; |
| 287 } | 287 } |
| 288 | 288 |
| 289 PermissionRequestType | 289 PermissionRequestType |
| 290 MediaStreamDevicesController::Request::GetPermissionRequestType() const { | 290 MediaStreamDevicesController::Request::GetPermissionRequestType() const { |
| 291 return PermissionRequestType::MEDIA_STREAM; | 291 return PermissionRequestType::MEDIA_STREAM; |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool MediaStreamDevicesController::Request::ShouldShowPersistenceToggle() | 294 bool MediaStreamDevicesController::Request::ShouldShowPersistenceToggle() |
| 295 const { | 295 const { |
| 296 return PermissionUtil::ShouldShowPersistenceToggle(); | 296 // Camera and Mic are handled the same w.r.t. showing the persistence toggle, |
| 297 // just check camera here for simplicity (this class will be removed once the |
| 298 // Android and media refactorings are finished). |
| 299 return PermissionUtil::ShouldShowPersistenceToggle( |
| 300 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 297 } | 301 } |
| 298 | 302 |
| 299 // Implementation of PermissionPromptDelegate which actually shows a permission | 303 // Implementation of PermissionPromptDelegate which actually shows a permission |
| 300 // prompt. | 304 // prompt. |
| 301 class MediaStreamDevicesController::PermissionPromptDelegateImpl | 305 class MediaStreamDevicesController::PermissionPromptDelegateImpl |
| 302 : public MediaStreamDevicesController::PermissionPromptDelegate { | 306 : public MediaStreamDevicesController::PermissionPromptDelegate { |
| 303 public: | 307 public: |
| 304 void ShowPrompt( | 308 void ShowPrompt( |
| 305 bool user_gesture, | 309 bool user_gesture, |
| 306 content::WebContents* web_contents, | 310 content::WebContents* web_contents, |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 776 } |
| 773 } | 777 } |
| 774 | 778 |
| 775 // Don't approve device requests if the tab was hidden. | 779 // Don't approve device requests if the tab was hidden. |
| 776 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 780 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 777 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 781 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 778 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 782 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 779 #endif | 783 #endif |
| 780 return true; | 784 return true; |
| 781 } | 785 } |
| OLD | NEW |