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

Side by Side Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_base.cc

Issue 2961193002: Use same DesktopCaptureOptions in DesktopCaptureBase and DesktopCaptureDevice (Closed)
Patch Set: Sync latest changes Created 3 years, 5 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 | « no previous file | content/browser/media/capture/desktop_capture_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/extensions/api/desktop_capture/desktop_capture_base.h" 5 #include "chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/extensions/extension_tab_util.h" 14 #include "chrome/browser/extensions/extension_tab_util.h"
15 #include "chrome/browser/media/webrtc/desktop_media_list_ash.h" 15 #include "chrome/browser/media/webrtc/desktop_media_list_ash.h"
16 #include "chrome/browser/media/webrtc/desktop_streams_registry.h" 16 #include "chrome/browser/media/webrtc/desktop_streams_registry.h"
17 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" 17 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
18 #include "chrome/browser/media/webrtc/native_desktop_media_list.h" 18 #include "chrome/browser/media/webrtc/native_desktop_media_list.h"
19 #include "chrome/browser/media/webrtc/tab_desktop_media_list.h" 19 #include "chrome/browser/media/webrtc/tab_desktop_media_list.h"
20 #include "chrome/browser/ui/browser_finder.h" 20 #include "chrome/browser/ui/browser_finder.h"
21 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
22 #include "chrome/grit/chromium_strings.h" 22 #include "chrome/grit/chromium_strings.h"
23 #include "content/public/browser/desktop_capture.h"
23 #include "content/public/browser/render_frame_host.h" 24 #include "content/public/browser/render_frame_host.h"
24 #include "content/public/browser/render_process_host.h" 25 #include "content/public/browser/render_process_host.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "extensions/common/manifest.h" 27 #include "extensions/common/manifest.h"
27 #include "extensions/common/switches.h" 28 #include "extensions/common/switches.h"
28 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" 29 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
29 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" 30 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
30 #include "ui/base/l10n/l10n_util.h" 31 #include "ui/base/l10n/l10n_util.h"
31 32
32 using content::DesktopMediaID; 33 using content::DesktopMediaID;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 113 }
113 std::unique_ptr<DesktopMediaList> screen_list; 114 std::unique_ptr<DesktopMediaList> screen_list;
114 if (g_picker_factory) { 115 if (g_picker_factory) {
115 screen_list = 116 screen_list =
116 g_picker_factory->CreateMediaList(DesktopMediaID::TYPE_SCREEN); 117 g_picker_factory->CreateMediaList(DesktopMediaID::TYPE_SCREEN);
117 } else { 118 } else {
118 #if defined(USE_ASH) 119 #if defined(USE_ASH)
119 screen_list = base::MakeUnique<DesktopMediaListAsh>( 120 screen_list = base::MakeUnique<DesktopMediaListAsh>(
120 DesktopMediaID::TYPE_SCREEN); 121 DesktopMediaID::TYPE_SCREEN);
121 #else // !defined(USE_ASH) 122 #else // !defined(USE_ASH)
122 webrtc::DesktopCaptureOptions capture_options =
123 webrtc::DesktopCaptureOptions::CreateDefault();
124 capture_options.set_disable_effects(false);
125 screen_list = base::MakeUnique<NativeDesktopMediaList>( 123 screen_list = base::MakeUnique<NativeDesktopMediaList>(
126 DesktopMediaID::TYPE_SCREEN, 124 content::DesktopMediaID::TYPE_SCREEN,
127 webrtc::DesktopCapturer::CreateScreenCapturer(capture_options)); 125 webrtc::DesktopCapturer::CreateScreenCapturer(
126 content::CreateDesktopCaptureOptions()));
128 #endif // !defined(USE_ASH) 127 #endif // !defined(USE_ASH)
129 } 128 }
130 have_screen_list = true; 129 have_screen_list = true;
131 source_lists.push_back(std::move(screen_list)); 130 source_lists.push_back(std::move(screen_list));
132 break; 131 break;
133 } 132 }
134 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: { 133 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: {
135 if (have_window_list) { 134 if (have_window_list) {
136 continue; 135 continue;
137 } 136 }
138 std::unique_ptr<DesktopMediaList> window_list; 137 std::unique_ptr<DesktopMediaList> window_list;
139 if (g_picker_factory) { 138 if (g_picker_factory) {
140 window_list = 139 window_list =
141 g_picker_factory->CreateMediaList(DesktopMediaID::TYPE_WINDOW); 140 g_picker_factory->CreateMediaList(DesktopMediaID::TYPE_WINDOW);
142 } else { 141 } else {
143 #if defined(USE_ASH) 142 #if defined(USE_ASH)
144 window_list = base::MakeUnique<DesktopMediaListAsh>( 143 window_list = base::MakeUnique<DesktopMediaListAsh>(
145 DesktopMediaID::TYPE_WINDOW); 144 DesktopMediaID::TYPE_WINDOW);
146 #else // !defined(USE_ASH) 145 #else // !defined(USE_ASH)
147 // NativeDesktopMediaList calls the capturers on a background thread. 146 // NativeDesktopMediaList calls the capturers on a background thread.
148 // This means that the two DesktopCapturer instances (for screens and 147 // This means that the two DesktopCapturer instances (for screens and
149 // windows) created here cannot share the same DesktopCaptureOptions 148 // windows) created here cannot share the same DesktopCaptureOptions
150 // instance. DesktopCaptureOptions owns X connection, which cannot be 149 // instance. DesktopCaptureOptions owns X connection, which cannot be
151 // used on multiple threads concurrently. 150 // used on multiple threads concurrently.
152 webrtc::DesktopCaptureOptions capture_options =
153 webrtc::DesktopCaptureOptions::CreateDefault();
154 capture_options.set_disable_effects(false);
155 window_list = base::MakeUnique<NativeDesktopMediaList>( 151 window_list = base::MakeUnique<NativeDesktopMediaList>(
156 DesktopMediaID::TYPE_WINDOW, 152 content::DesktopMediaID::TYPE_WINDOW,
157 webrtc::DesktopCapturer::CreateWindowCapturer(capture_options)); 153 webrtc::DesktopCapturer::CreateWindowCapturer(
154 content::CreateDesktopCaptureOptions()));
158 #endif // !defined(USE_ASH) 155 #endif // !defined(USE_ASH)
159 } 156 }
160 have_window_list = true; 157 have_window_list = true;
161 source_lists.push_back(std::move(window_list)); 158 source_lists.push_back(std::move(window_list));
162 break; 159 break;
163 } 160 }
164 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: { 161 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: {
165 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 162 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
166 extensions::switches::kDisableTabForDesktopShare) || 163 extensions::switches::kDisableTabForDesktopShare) ||
167 have_tab_list) { 164 have_tab_list) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 307
311 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, 308 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id,
312 int request_id) { 309 int request_id) {
313 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); 310 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id));
314 if (it != requests_.end()) 311 if (it != requests_.end())
315 it->second->Cancel(); 312 it->second->Cancel();
316 } 313 }
317 314
318 315
319 } // namespace extensions 316 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/capture/desktop_capture_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698