| 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/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 namespace extensions { | 33 namespace extensions { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 picker_ = g_picker_factory->CreatePicker(); | 144 picker_ = g_picker_factory->CreatePicker(); |
| 144 } else { | 145 } else { |
| 145 // Create a screens list. | 146 // Create a screens list. |
| 146 if (show_screens) { | 147 if (show_screens) { |
| 147 #if defined(USE_ASH) | 148 #if defined(USE_ASH) |
| 148 screen_list = | 149 screen_list = |
| 149 base::MakeUnique<DesktopMediaListAsh>(DesktopMediaListAsh::SCREENS); | 150 base::MakeUnique<DesktopMediaListAsh>(DesktopMediaListAsh::SCREENS); |
| 150 #endif | 151 #endif |
| 151 if (!screen_list) { | 152 if (!screen_list) { |
| 152 webrtc::DesktopCaptureOptions options = | 153 webrtc::DesktopCaptureOptions options = |
| 153 webrtc::DesktopCaptureOptions::CreateDefault(); | 154 content::CreateDesktopCaptureOptions(); |
| 154 options.set_disable_effects(false); | |
| 155 std::unique_ptr<webrtc::DesktopCapturer> screen_capturer( | 155 std::unique_ptr<webrtc::DesktopCapturer> screen_capturer( |
| 156 webrtc::DesktopCapturer::CreateScreenCapturer(options)); | 156 webrtc::DesktopCapturer::CreateScreenCapturer(options)); |
| 157 | 157 |
| 158 screen_list = base::MakeUnique<NativeDesktopMediaList>( | 158 screen_list = base::MakeUnique<NativeDesktopMediaList>( |
| 159 std::move(screen_capturer), nullptr); | 159 std::move(screen_capturer), nullptr); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Create a windows list. | 163 // Create a windows list. |
| 164 if (show_windows) { | 164 if (show_windows) { |
| 165 #if defined(USE_ASH) | 165 #if defined(USE_ASH) |
| 166 window_list = | 166 window_list = |
| 167 base::MakeUnique<DesktopMediaListAsh>(DesktopMediaListAsh::WINDOWS); | 167 base::MakeUnique<DesktopMediaListAsh>(DesktopMediaListAsh::WINDOWS); |
| 168 #endif | 168 #endif |
| 169 if (!window_list) { | 169 if (!window_list) { |
| 170 webrtc::DesktopCaptureOptions options = | 170 webrtc::DesktopCaptureOptions options = |
| 171 webrtc::DesktopCaptureOptions::CreateDefault(); | 171 content::CreateDesktopCaptureOptions(); |
| 172 options.set_disable_effects(false); | |
| 173 std::unique_ptr<webrtc::DesktopCapturer> window_capturer( | 172 std::unique_ptr<webrtc::DesktopCapturer> window_capturer( |
| 174 webrtc::DesktopCapturer::CreateWindowCapturer(options)); | 173 webrtc::DesktopCapturer::CreateWindowCapturer(options)); |
| 175 | 174 |
| 176 window_list = base::MakeUnique<NativeDesktopMediaList>( | 175 window_list = base::MakeUnique<NativeDesktopMediaList>( |
| 177 nullptr, std::move(window_capturer)); | 176 nullptr, std::move(window_capturer)); |
| 178 } | 177 } |
| 179 } | 178 } |
| 180 | 179 |
| 181 if (show_tabs) | 180 if (show_tabs) |
| 182 tab_list = base::MakeUnique<TabDesktopMediaList>(); | 181 tab_list = base::MakeUnique<TabDesktopMediaList>(); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 297 |
| 299 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 298 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 300 int request_id) { | 299 int request_id) { |
| 301 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 300 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 302 if (it != requests_.end()) | 301 if (it != requests_.end()) |
| 303 it->second->Cancel(); | 302 it->second->Cancel(); |
| 304 } | 303 } |
| 305 | 304 |
| 306 | 305 |
| 307 } // namespace extensions | 306 } // namespace extensions |
| OLD | NEW |