| 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/common/channel_info.h" | |
| 21 #include "components/version_info/version_info.h" | 20 #include "components/version_info/version_info.h" |
| 22 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
| 23 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 25 #include "extensions/common/switches.h" | 24 #include "extensions/common/switches.h" |
| 26 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 25 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 27 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 26 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 28 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" | 27 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" |
| 29 | 28 |
| 30 namespace extensions { | 29 namespace extensions { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 90 |
| 92 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_SCREEN: | 91 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_SCREEN: |
| 93 show_screens = true; | 92 show_screens = true; |
| 94 break; | 93 break; |
| 95 | 94 |
| 96 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: | 95 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: |
| 97 show_windows = true; | 96 show_windows = true; |
| 98 break; | 97 break; |
| 99 | 98 |
| 100 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: | 99 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: |
| 101 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 100 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 102 extensions::switches::kEnableTabForDesktopShare)) { | 101 extensions::switches::kDisableTabForDesktopShare)) { |
| 103 show_tabs = true; | 102 show_tabs = true; |
| 104 } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 105 extensions::switches::kDisableTabForDesktopShare)) { | |
| 106 show_tabs = false; | |
| 107 } else { | |
| 108 const version_info::Channel channel = chrome::GetChannel(); | |
| 109 if ((channel == version_info::Channel::STABLE) || | |
| 110 (channel == version_info::Channel::BETA)) { | |
| 111 show_tabs = false; | |
| 112 } else { | |
| 113 show_tabs = true; | |
| 114 } | |
| 115 } | 103 } |
| 116 break; | 104 break; |
| 117 | 105 |
| 118 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO: | 106 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO: |
| 119 bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( | 107 bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 120 extensions::switches::kDisableDesktopCaptureAudio); | 108 extensions::switches::kDisableDesktopCaptureAudio); |
| 121 request_audio = !has_flag; | 109 request_audio = !has_flag; |
| 122 break; | 110 break; |
| 123 } | 111 } |
| 124 } | 112 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 272 |
| 285 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 273 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 286 int request_id) { | 274 int request_id) { |
| 287 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 275 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 288 if (it != requests_.end()) | 276 if (it != requests_.end()) |
| 289 it->second->Cancel(); | 277 it->second->Cancel(); |
| 290 } | 278 } |
| 291 | 279 |
| 292 | 280 |
| 293 } // namespace extensions | 281 } // namespace extensions |
| OLD | NEW |