Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 | 90 |
| 91 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_SCREEN: | 91 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_SCREEN: |
| 92 show_screens = true; | 92 show_screens = true; |
| 93 break; | 93 break; |
| 94 | 94 |
| 95 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: | 95 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_WINDOW: |
| 96 show_windows = true; | 96 show_windows = true; |
| 97 break; | 97 break; |
| 98 | 98 |
| 99 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: | 99 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_TAB: |
| 100 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 100 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 101 extensions::switches::kEnableTabForDesktopShare)) { | 101 extensions::switches::kDisableTabForDesktopShare)) { |
| 102 show_tabs = true; | 102 show_tabs = true; |
| 103 } | 103 } |
| 104 break; | 104 break; |
| 105 | 105 |
| 106 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO: | 106 case api::desktop_capture::DESKTOP_CAPTURE_SOURCE_TYPE_AUDIO: |
| 107 bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( | 107 bool has_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 108 extensions::switches::kEnableDesktopCaptureAudio); | 108 extensions::switches::kDisableDesktopCaptureAudio); |
| 109 request_audio = has_flag; | 109 request_audio = !has_flag; |
|
Sergey Ulanov
2016/03/29 18:48:19
What if the application doesn't care about audio?
qiangchen
2016/03/29 20:10:44
Yes. When here we detect a request with type "DESK
Sergey Ulanov
2016/03/30 19:34:22
I see. To be honest this doesn't look like a good
| |
| 110 break; | 110 break; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 if (!show_screens && !show_windows && !show_tabs) { | 114 if (!show_screens && !show_windows && !show_tabs) { |
| 115 error_ = kEmptySourcesListError; | 115 error_ = kEmptySourcesListError; |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 const gfx::NativeWindow parent_window = | 119 const gfx::NativeWindow parent_window = |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 | 259 |
| 260 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, | 260 void DesktopCaptureRequestsRegistry::CancelRequest(int process_id, |
| 261 int request_id) { | 261 int request_id) { |
| 262 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); | 262 RequestsMap::iterator it = requests_.find(RequestId(process_id, request_id)); |
| 263 if (it != requests_.end()) | 263 if (it != requests_.end()) |
| 264 it->second->Cancel(); | 264 it->second->Cancel(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 | 267 |
| 268 } // namespace extensions | 268 } // namespace extensions |
| OLD | NEW |