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

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

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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
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 9
9 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 #include "chrome/browser/extensions/extension_tab_util.h" 12 #include "chrome/browser/extensions/extension_tab_util.h"
12 #include "chrome/browser/media/desktop_media_list_ash.h" 13 #include "chrome/browser/media/desktop_media_list_ash.h"
13 #include "chrome/browser/media/desktop_streams_registry.h" 14 #include "chrome/browser/media/desktop_streams_registry.h"
14 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 15 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
15 #include "chrome/browser/media/native_desktop_media_list.h" 16 #include "chrome/browser/media/native_desktop_media_list.h"
16 #include "chrome/browser/ui/ash/ash_util.h" 17 #include "chrome/browser/ui/ash/ash_util.h"
17 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 #endif 119 #endif
119 if (!media_list) { 120 if (!media_list) {
120 webrtc::DesktopCaptureOptions options = 121 webrtc::DesktopCaptureOptions options =
121 webrtc::DesktopCaptureOptions::CreateDefault(); 122 webrtc::DesktopCaptureOptions::CreateDefault();
122 options.set_disable_effects(false); 123 options.set_disable_effects(false);
123 scoped_ptr<webrtc::ScreenCapturer> screen_capturer( 124 scoped_ptr<webrtc::ScreenCapturer> screen_capturer(
124 show_screens ? webrtc::ScreenCapturer::Create(options) : NULL); 125 show_screens ? webrtc::ScreenCapturer::Create(options) : NULL);
125 scoped_ptr<webrtc::WindowCapturer> window_capturer( 126 scoped_ptr<webrtc::WindowCapturer> window_capturer(
126 show_windows ? webrtc::WindowCapturer::Create(options) : NULL); 127 show_windows ? webrtc::WindowCapturer::Create(options) : NULL);
127 128
128 media_list.reset(new NativeDesktopMediaList( 129 media_list.reset(new NativeDesktopMediaList(std::move(screen_capturer),
129 screen_capturer.Pass(), window_capturer.Pass())); 130 std::move(window_capturer)));
130 } 131 }
131 132
132 // DesktopMediaPicker is implemented only for Windows, OSX and 133 // DesktopMediaPicker is implemented only for Windows, OSX and
133 // Aura Linux builds. 134 // Aura Linux builds.
134 // TODO(bshe): Use ANDROID_JAVA_UI flag here after it landed. 135 // TODO(bshe): Use ANDROID_JAVA_UI flag here after it landed.
135 #if (defined(TOOLKIT_VIEWS) && !defined(OS_ANDROID)) || defined(OS_MACOSX) 136 #if (defined(TOOLKIT_VIEWS) && !defined(OS_ANDROID)) || defined(OS_MACOSX)
136 // TODO(bshe): This is called if chrome.desktopCapture.chooseDesktopMedia 137 // TODO(bshe): This is called if chrome.desktopCapture.chooseDesktopMedia
137 // or chrome.webrtcDesktopCapturePrivate.chooseDesktopMedia are called by 138 // or chrome.webrtcDesktopCapturePrivate.chooseDesktopMedia are called by
138 // extensions. Simply return error message on Android platform for now. 139 // extensions. Simply return error message on Android platform for now.
139 // Revisit this when necessary. See crbug.com/557424. 140 // Revisit this when necessary. See crbug.com/557424.
140 picker_ = DesktopMediaPicker::Create(); 141 picker_ = DesktopMediaPicker::Create();
141 #else 142 #else
142 error_ = "Desktop Capture API is not yet implemented for this platform."; 143 error_ = "Desktop Capture API is not yet implemented for this platform.";
143 return false; 144 return false;
144 #endif 145 #endif
145 } 146 }
146 DesktopMediaPicker::DoneCallback callback = base::Bind( 147 DesktopMediaPicker::DoneCallback callback = base::Bind(
147 &DesktopCaptureChooseDesktopMediaFunctionBase::OnPickerDialogResults, 148 &DesktopCaptureChooseDesktopMediaFunctionBase::OnPickerDialogResults,
148 this); 149 this);
149 150
150 picker_->Show(web_contents, 151 picker_->Show(web_contents, parent_window, parent_window,
151 parent_window, 152 base::UTF8ToUTF16(extension()->name()), target_name,
152 parent_window, 153 std::move(media_list), callback);
153 base::UTF8ToUTF16(extension()->name()),
154 target_name,
155 media_list.Pass(),
156 callback);
157 origin_ = origin; 154 origin_ = origin;
158 return true; 155 return true;
159 } 156 }
160 157
161 void DesktopCaptureChooseDesktopMediaFunctionBase::WebContentsDestroyed() { 158 void DesktopCaptureChooseDesktopMediaFunctionBase::WebContentsDestroyed() {
162 Cancel(); 159 Cancel();
163 } 160 }
164 161
165 void DesktopCaptureChooseDesktopMediaFunctionBase::OnPickerDialogResults( 162 void DesktopCaptureChooseDesktopMediaFunctionBase::OnPickerDialogResults(
166 content::DesktopMediaID source) { 163 content::DesktopMediaID source) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 234
238 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, 235 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id,
239 int request_id) { 236 int request_id) {
240 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); 237 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id));
241 if (it != requests_.end()) 238 if (it != requests_.end())
242 it->second->Cancel(); 239 it->second->Cancel();
243 } 240 }
244 241
245 242
246 } // namespace extensions 243 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698