| 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" |
| 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/desktop_media_list_ash.h" | 15 #include "chrome/browser/media/desktop_media_list_ash.h" |
| 16 #include "chrome/browser/media/desktop_streams_registry.h" | 16 #include "chrome/browser/media/desktop_streams_registry.h" |
| 17 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 17 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 18 #include "chrome/browser/media/native_desktop_media_list.h" | 18 #include "chrome/browser/media/native_desktop_media_list.h" |
| 19 #include "chrome/browser/media/tab_desktop_media_list.h" | 19 #include "chrome/browser/media/tab_desktop_media_list.h" |
| 20 #include "chrome/browser/ui/ash/ash_util.h" | |
| 21 #include "chrome/common/channel_info.h" | 20 #include "chrome/common/channel_info.h" |
| 22 #include "components/version_info/version_info.h" | 21 #include "components/version_info/version_info.h" |
| 23 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
| 24 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
| 25 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 26 #include "extensions/common/switches.h" | 25 #include "extensions/common/switches.h" |
| 27 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 26 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 28 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 27 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 29 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" | 28 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" |
| 30 | 29 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 g_picker_factory->CreateModel(show_screens, show_windows, show_tabs, | 138 g_picker_factory->CreateModel(show_screens, show_windows, show_tabs, |
| 140 request_audio); | 139 request_audio); |
| 141 screen_list = std::move(media_lists[0]); | 140 screen_list = std::move(media_lists[0]); |
| 142 window_list = std::move(media_lists[1]); | 141 window_list = std::move(media_lists[1]); |
| 143 tab_list = std::move(media_lists[2]); | 142 tab_list = std::move(media_lists[2]); |
| 144 picker_ = g_picker_factory->CreatePicker(); | 143 picker_ = g_picker_factory->CreatePicker(); |
| 145 } else { | 144 } else { |
| 146 // Create a screens list. | 145 // Create a screens list. |
| 147 if (show_screens) { | 146 if (show_screens) { |
| 148 #if defined(USE_ASH) | 147 #if defined(USE_ASH) |
| 149 if (chrome::IsNativeWindowInAsh(parent_window)) { | 148 screen_list = base::WrapUnique( |
| 150 screen_list = base::WrapUnique( | 149 new DesktopMediaListAsh(DesktopMediaListAsh::SCREENS)); |
| 151 new DesktopMediaListAsh(DesktopMediaListAsh::SCREENS)); | |
| 152 } | |
| 153 #endif | 150 #endif |
| 154 if (!screen_list) { | 151 if (!screen_list) { |
| 155 webrtc::DesktopCaptureOptions options = | 152 webrtc::DesktopCaptureOptions options = |
| 156 webrtc::DesktopCaptureOptions::CreateDefault(); | 153 webrtc::DesktopCaptureOptions::CreateDefault(); |
| 157 options.set_disable_effects(false); | 154 options.set_disable_effects(false); |
| 158 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer( | 155 std::unique_ptr<webrtc::ScreenCapturer> screen_capturer( |
| 159 webrtc::ScreenCapturer::Create(options)); | 156 webrtc::ScreenCapturer::Create(options)); |
| 160 | 157 |
| 161 screen_list = base::WrapUnique( | 158 screen_list = base::WrapUnique( |
| 162 new NativeDesktopMediaList(std::move(screen_capturer), nullptr)); | 159 new NativeDesktopMediaList(std::move(screen_capturer), nullptr)); |
| 163 } | 160 } |
| 164 } | 161 } |
| 165 | 162 |
| 166 // Create a windows list. | 163 // Create a windows list. |
| 167 if (show_windows) { | 164 if (show_windows) { |
| 168 #if defined(USE_ASH) | 165 #if defined(USE_ASH) |
| 169 if (chrome::IsNativeWindowInAsh(parent_window)) { | 166 window_list = base::WrapUnique( |
| 170 window_list = base::WrapUnique( | 167 new DesktopMediaListAsh(DesktopMediaListAsh::WINDOWS)); |
| 171 new DesktopMediaListAsh(DesktopMediaListAsh::WINDOWS)); | |
| 172 } | |
| 173 #endif | 168 #endif |
| 174 if (!window_list) { | 169 if (!window_list) { |
| 175 webrtc::DesktopCaptureOptions options = | 170 webrtc::DesktopCaptureOptions options = |
| 176 webrtc::DesktopCaptureOptions::CreateDefault(); | 171 webrtc::DesktopCaptureOptions::CreateDefault(); |
| 177 options.set_disable_effects(false); | 172 options.set_disable_effects(false); |
| 178 std::unique_ptr<webrtc::WindowCapturer> window_capturer( | 173 std::unique_ptr<webrtc::WindowCapturer> window_capturer( |
| 179 webrtc::WindowCapturer::Create(options)); | 174 webrtc::WindowCapturer::Create(options)); |
| 180 | 175 |
| 181 window_list = base::WrapUnique( | 176 window_list = base::WrapUnique( |
| 182 new NativeDesktopMediaList(nullptr, std::move(window_capturer))); | 177 new NativeDesktopMediaList(nullptr, std::move(window_capturer))); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 284 |
| 290 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 285 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 291 int request_id) { | 286 int request_id) { |
| 292 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 287 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 293 if (it != requests_.end()) | 288 if (it != requests_.end()) |
| 294 it->second->Cancel(); | 289 it->second->Cancel(); |
| 295 } | 290 } |
| 296 | 291 |
| 297 | 292 |
| 298 } // namespace extensions | 293 } // namespace extensions |
| OLD | NEW |