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/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" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 g_picker_factory->CreateModel(show_screens, show_windows, show_tabs, | 126 g_picker_factory->CreateModel(show_screens, show_windows, show_tabs, |
127 request_audio); | 127 request_audio); |
128 screen_list = std::move(media_lists[0]); | 128 screen_list = std::move(media_lists[0]); |
129 window_list = std::move(media_lists[1]); | 129 window_list = std::move(media_lists[1]); |
130 tab_list = std::move(media_lists[2]); | 130 tab_list = std::move(media_lists[2]); |
131 picker_ = g_picker_factory->CreatePicker(); | 131 picker_ = g_picker_factory->CreatePicker(); |
132 } else { | 132 } else { |
133 // Create a screens list. | 133 // Create a screens list. |
134 if (show_screens) { | 134 if (show_screens) { |
135 #if defined(USE_ASH) | 135 #if defined(USE_ASH) |
136 screen_list = base::WrapUnique( | 136 screen_list = |
137 new DesktopMediaListAsh(DesktopMediaListAsh::SCREENS)); | 137 base::MakeUnique<DesktopMediaListAsh>(DesktopMediaListAsh::SCREENS); |
138 #endif | 138 #endif |
139 if (!screen_list) { | 139 if (!screen_list) { |
140 webrtc::DesktopCaptureOptions options = | 140 webrtc::DesktopCaptureOptions options = |
141 webrtc::DesktopCaptureOptions::CreateDefault(); | 141 webrtc::DesktopCaptureOptions::CreateDefault(); |
142 options.set_disable_effects(false); | 142 options.set_disable_effects(false); |
143 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer( | 143 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer( |
144 webrtc::ScreenCapturer::Create(options)); | 144 webrtc::ScreenCapturer::Create(options)); |
145 | 145 |
146 screen_list = base::WrapUnique( | 146 screen_list = base::MakeUnique<NativeDesktopMediaList>( |
147 new NativeDesktopMediaList(std::move(screen_capturer), nullptr)); | 147 std::move(screen_capturer), nullptr); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 // Create a windows list. | 151 // Create a windows list. |
152 if (show_windows) { | 152 if (show_windows) { |
153 #if defined(USE_ASH) | 153 #if defined(USE_ASH) |
154 window_list = base::WrapUnique( | 154 window_list = |
155 new DesktopMediaListAsh(DesktopMediaListAsh::WINDOWS)); | 155 base::MakeUnique<DesktopMediaListAsh>(DesktopMediaListAsh::WINDOWS); |
156 #endif | 156 #endif |
157 if (!window_list) { | 157 if (!window_list) { |
158 webrtc::DesktopCaptureOptions options = | 158 webrtc::DesktopCaptureOptions options = |
159 webrtc::DesktopCaptureOptions::CreateDefault(); | 159 webrtc::DesktopCaptureOptions::CreateDefault(); |
160 options.set_disable_effects(false); | 160 options.set_disable_effects(false); |
161 std::unique_ptr<webrtc::WindowCapturer> window_capturer( | 161 std::unique_ptr<webrtc::WindowCapturer> window_capturer( |
162 webrtc::WindowCapturer::Create(options)); | 162 webrtc::WindowCapturer::Create(options)); |
163 | 163 |
164 window_list = base::WrapUnique( | 164 window_list = base::MakeUnique<NativeDesktopMediaList>( |
165 new NativeDesktopMediaList(nullptr, std::move(window_capturer))); | 165 nullptr, std::move(window_capturer)); |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 if (show_tabs) | 169 if (show_tabs) |
170 tab_list = base::WrapUnique(new TabDesktopMediaList()); | 170 tab_list = base::MakeUnique<TabDesktopMediaList>(); |
171 | 171 |
172 DCHECK(screen_list || window_list || tab_list); | 172 DCHECK(screen_list || window_list || tab_list); |
173 | 173 |
174 // DesktopMediaPicker is implemented only for Windows, OSX and | 174 // DesktopMediaPicker is implemented only for Windows, OSX and |
175 // Aura Linux builds. | 175 // Aura Linux builds. |
176 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) | 176 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
177 picker_ = DesktopMediaPicker::Create(); | 177 picker_ = DesktopMediaPicker::Create(); |
178 #else | 178 #else |
179 error_ = "Desktop Capture API is not yet implemented for this platform."; | 179 error_ = "Desktop Capture API is not yet implemented for this platform."; |
180 return false; | 180 return false; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 273 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
274 int request_id) { | 274 int request_id) { |
275 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 275 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
276 if (it != requests_.end()) | 276 if (it != requests_.end()) |
277 it->second->Cancel(); | 277 it->second->Cancel(); |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 } // namespace extensions | 281 } // namespace extensions |
OLD | NEW |