| 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/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "chrome/browser/extensions/extension_tab_util.h" | 13 #include "chrome/browser/extensions/extension_tab_util.h" |
| 14 #include "chrome/browser/media/combined_desktop_media_list.h" | 14 #include "chrome/browser/media/combined_desktop_media_list.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" | 20 #include "chrome/browser/ui/ash/ash_util.h" |
| 21 #include "chrome/common/channel_info.h" |
| 22 #include "components/version_info/version_info.h" |
| 21 #include "content/public/browser/render_frame_host.h" | 23 #include "content/public/browser/render_frame_host.h" |
| 22 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 24 #include "extensions/common/switches.h" | 26 #include "extensions/common/switches.h" |
| 25 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 27 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 26 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 28 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 27 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" | 29 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" |
| 28 | 30 |
| 29 namespace extensions { | 31 namespace extensions { |
| 30 | 32 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 break; | 95 break; |
| 94 | 96 |
| 95 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: | 97 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: |
| 96 show_windows = true; | 98 show_windows = true; |
| 97 break; | 99 break; |
| 98 | 100 |
| 99 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: | 101 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: |
| 100 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 102 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 101 extensions::switches::kEnableTabForDesktopShare)) { | 103 extensions::switches::kEnableTabForDesktopShare)) { |
| 102 show_tabs = true; | 104 show_tabs = true; |
| 105 } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 106 extensions::switches::kDisableTabForDesktopShare)) { |
| 107 show_tabs = false; |
| 108 } else { |
| 109 const version_info::Channel channel = chrome::GetChannel(); |
| 110 show_tabs = (channel != version_info::Channel::STABLE); |
| 103 } | 111 } |
| 104 break; | 112 break; |
| 105 | 113 |
| 106 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO: | 114 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO: |
| 107 bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( | 115 bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 108 extensions::switches::kEnableDesktopCaptureAudio); | 116 extensions::switches::kDisableDesktopCaptureAudio); |
| 109 request_audio = has_flag; | 117 request_audio = !has_flag; |
| 110 break; | 118 break; |
| 111 } | 119 } |
| 112 } | 120 } |
| 113 | 121 |
| 114 if (!show_screens && !show_windows && !show_tabs) { | 122 if (!show_screens && !show_windows && !show_tabs) { |
| 115 error_ = kEmptySourcesListError; | 123 error_ = kEmptySourcesListError; |
| 116 return false; | 124 return false; |
| 117 } | 125 } |
| 118 | 126 |
| 119 const gfx::NativeWindow parent_window = | 127 const gfx::NativeWindow parent_window = |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 267 |
| 260 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 268 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 261 int request_id) { | 269 int request_id) { |
| 262 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 270 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 263 if (it != requests_.end()) | 271 if (it != requests_.end()) |
| 264 it->second->Cancel(); | 272 it->second->Cancel(); |
| 265 } | 273 } |
| 266 | 274 |
| 267 | 275 |
| 268 } // namespace extensions | 276 } // namespace extensions |
| OLD | NEW |