| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/tab_capture_access_handler.h" | 5 #include "chrome/browser/media/webrtc/tab_capture_access_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" | 9 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h" |
| 10 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 10 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 11 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 11 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
| 14 #include "extensions/common/permissions/permissions_data.h" | 14 #include "extensions/common/permissions/permissions_data.h" |
| 15 | 15 |
| 16 TabCaptureAccessHandler::TabCaptureAccessHandler() { | 16 TabCaptureAccessHandler::TabCaptureAccessHandler() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 TabCaptureAccessHandler::~TabCaptureAccessHandler() { | 19 TabCaptureAccessHandler::~TabCaptureAccessHandler() { |
| 20 } | 20 } |
| 21 | 21 |
| 22 bool TabCaptureAccessHandler::SupportsStreamType( | 22 bool TabCaptureAccessHandler::SupportsStreamType( |
| 23 content::WebContents* web_contents, |
| 23 const content::MediaStreamType type, | 24 const content::MediaStreamType type, |
| 24 const extensions::Extension* extension) { | 25 const extensions::Extension* extension) { |
| 25 return type == content::MEDIA_TAB_VIDEO_CAPTURE || | 26 return type == content::MEDIA_TAB_VIDEO_CAPTURE || |
| 26 type == content::MEDIA_TAB_AUDIO_CAPTURE; | 27 type == content::MEDIA_TAB_AUDIO_CAPTURE; |
| 27 } | 28 } |
| 28 | 29 |
| 29 bool TabCaptureAccessHandler::CheckMediaAccessPermission( | 30 bool TabCaptureAccessHandler::CheckMediaAccessPermission( |
| 30 content::WebContents* web_contents, | 31 content::WebContents* web_contents, |
| 31 const GURL& security_origin, | 32 const GURL& security_origin, |
| 32 content::MediaStreamType type, | 33 content::MediaStreamType type, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (!devices.empty()) { | 78 if (!devices.empty()) { |
| 78 ui = MediaCaptureDevicesDispatcher::GetInstance() | 79 ui = MediaCaptureDevicesDispatcher::GetInstance() |
| 79 ->GetMediaStreamCaptureIndicator() | 80 ->GetMediaStreamCaptureIndicator() |
| 80 ->RegisterMediaStream(web_contents, devices); | 81 ->RegisterMediaStream(web_contents, devices); |
| 81 } | 82 } |
| 82 UpdateExtensionTrusted(request, extension); | 83 UpdateExtensionTrusted(request, extension); |
| 83 callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE | 84 callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE |
| 84 : content::MEDIA_DEVICE_OK, | 85 : content::MEDIA_DEVICE_OK, |
| 85 std::move(ui)); | 86 std::move(ui)); |
| 86 } | 87 } |
| OLD | NEW |