Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: content/browser/renderer_host/media/media_stream_manager.cc

Issue 1763753003: Capture chrome browser windows from internal rendering procedure for windows and linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/media/tab_desktop_media_list.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/renderer_host/media/media_stream_manager.h" 5 #include "content/browser/renderer_host/media/media_stream_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <string.h> 9 #include <string.h>
10 #include <cctype> 10 #include <cctype>
(...skipping 20 matching lines...) Expand all
31 #include "content/browser/browser_main_loop.h" 31 #include "content/browser/browser_main_loop.h"
32 #include "content/browser/renderer_host/media/audio_input_device_manager.h" 32 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
33 #include "content/browser/renderer_host/media/audio_output_device_enumerator.h" 33 #include "content/browser/renderer_host/media/audio_output_device_enumerator.h"
34 #include "content/browser/renderer_host/media/media_capture_devices_impl.h" 34 #include "content/browser/renderer_host/media/media_capture_devices_impl.h"
35 #include "content/browser/renderer_host/media/media_stream_requester.h" 35 #include "content/browser/renderer_host/media/media_stream_requester.h"
36 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" 36 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h"
37 #include "content/browser/renderer_host/media/video_capture_manager.h" 37 #include "content/browser/renderer_host/media/video_capture_manager.h"
38 #include "content/browser/renderer_host/render_process_host_impl.h" 38 #include "content/browser/renderer_host/render_process_host_impl.h"
39 #include "content/public/browser/browser_thread.h" 39 #include "content/public/browser/browser_thread.h"
40 #include "content/public/browser/content_browser_client.h" 40 #include "content/public/browser/content_browser_client.h"
41 #include "content/public/browser/desktop_media_id.h"
41 #include "content/public/browser/media_observer.h" 42 #include "content/public/browser/media_observer.h"
42 #include "content/public/browser/media_request_state.h" 43 #include "content/public/browser/media_request_state.h"
43 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
44 #include "content/public/browser/web_contents_media_capture_id.h" 45 #include "content/public/browser/web_contents_media_capture_id.h"
45 #include "content/public/common/content_client.h" 46 #include "content/public/common/content_client.h"
46 #include "content/public/common/content_switches.h" 47 #include "content/public/common/content_switches.h"
47 #include "content/public/common/media_stream_request.h" 48 #include "content/public/common/media_stream_request.h"
48 #include "crypto/hmac.h" 49 #include "crypto/hmac.h"
49 #include "media/audio/audio_manager_base.h" 50 #include "media/audio/audio_manager_base.h"
50 #include "media/audio/audio_parameters.h" 51 #include "media/audio/audio_parameters.h"
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after
2045 void MediaStreamManager::OnMediaStreamUIWindowId(MediaStreamType video_type, 2046 void MediaStreamManager::OnMediaStreamUIWindowId(MediaStreamType video_type,
2046 StreamDeviceInfoArray devices, 2047 StreamDeviceInfoArray devices,
2047 gfx::NativeViewId window_id) { 2048 gfx::NativeViewId window_id) {
2048 DCHECK_CURRENTLY_ON(BrowserThread::IO); 2049 DCHECK_CURRENTLY_ON(BrowserThread::IO);
2049 if (!window_id) 2050 if (!window_id)
2050 return; 2051 return;
2051 2052
2052 if (video_type != MEDIA_DESKTOP_VIDEO_CAPTURE) 2053 if (video_type != MEDIA_DESKTOP_VIDEO_CAPTURE)
2053 return; 2054 return;
2054 2055
2055 // Pass along for desktop screen and window capturing. 2056 // Pass along for desktop screen and window capturing when
2057 // DesktopCaptureDevice is used.
2056 for (const StreamDeviceInfo& device_info : devices) { 2058 for (const StreamDeviceInfo& device_info : devices) {
2057 if (device_info.device.type == MEDIA_DESKTOP_VIDEO_CAPTURE && 2059 if (device_info.device.type != MEDIA_DESKTOP_VIDEO_CAPTURE)
2058 !WebContentsMediaCaptureId::IsWebContentsDeviceId( 2060 continue;
2059 device_info.device.id)) { 2061
2060 video_capture_manager_->SetDesktopCaptureWindowId(device_info.session_id, 2062 DesktopMediaID media_id = DesktopMediaID::Parse(device_info.device.id);
2061 window_id); 2063 // WebContentsVideoCaptureDevice is used for tab/webcontents.
2062 break; 2064 if (media_id.type == DesktopMediaID::TYPE_WEB_CONTENTS)
2063 } 2065 continue;
2066 #if defined(USE_AURA)
2067 // DesktopCaptureDevicAura is used when aura_id is valid.
2068 if (media_id.aura_id > DesktopMediaID::kNullId)
2069 continue;
2070 #endif
2071 video_capture_manager_->SetDesktopCaptureWindowId(device_info.session_id,
2072 window_id);
2073 break;
2064 } 2074 }
2065 } 2075 }
2066 2076
2067 void MediaStreamManager::DoNativeLogCallbackRegistration( 2077 void MediaStreamManager::DoNativeLogCallbackRegistration(
2068 int renderer_host_id, 2078 int renderer_host_id,
2069 const base::Callback<void(const std::string&)>& callback) { 2079 const base::Callback<void(const std::string&)>& callback) {
2070 DCHECK_CURRENTLY_ON(BrowserThread::IO); 2080 DCHECK_CURRENTLY_ON(BrowserThread::IO);
2071 // Re-registering (overwriting) is allowed and happens in some tests. 2081 // Re-registering (overwriting) is allowed and happens in some tests.
2072 log_callbacks_[renderer_host_id] = callback; 2082 log_callbacks_[renderer_host_id] = callback;
2073 } 2083 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 const std::string& device_guid, 2117 const std::string& device_guid,
2108 const std::string& raw_unique_id) { 2118 const std::string& raw_unique_id) {
2109 DCHECK(security_origin.is_valid()); 2119 DCHECK(security_origin.is_valid());
2110 DCHECK(!raw_unique_id.empty()); 2120 DCHECK(!raw_unique_id.empty());
2111 std::string guid_from_raw_device_id = 2121 std::string guid_from_raw_device_id =
2112 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id); 2122 GetHMACForMediaDeviceID(sc, security_origin, raw_unique_id);
2113 return guid_from_raw_device_id == device_guid; 2123 return guid_from_raw_device_id == device_guid;
2114 } 2124 }
2115 2125
2116 } // namespace content 2126 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/media/tab_desktop_media_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698