OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/cocoa/media_picker/desktop_media_picker_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_cocoa.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/command_line.h" |
| 10 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller_de
precated.h" |
9 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h" | 11 #import "chrome/browser/ui/cocoa/media_picker/desktop_media_picker_controller.h" |
| 12 #include "extensions/common/switches.h" |
10 | 13 |
11 DesktopMediaPickerCocoa::DesktopMediaPickerCocoa() { | 14 DesktopMediaPickerCocoa::DesktopMediaPickerCocoa() { |
12 } | 15 } |
13 | 16 |
14 DesktopMediaPickerCocoa::~DesktopMediaPickerCocoa() { | 17 DesktopMediaPickerCocoa::~DesktopMediaPickerCocoa() { |
15 } | 18 } |
16 | 19 |
17 void DesktopMediaPickerCocoa::Show( | 20 void DesktopMediaPickerCocoa::Show( |
18 content::WebContents* web_contents, | 21 content::WebContents* web_contents, |
19 gfx::NativeWindow context, | 22 gfx::NativeWindow context, |
20 gfx::NativeWindow parent, | 23 gfx::NativeWindow parent, |
21 const base::string16& app_name, | 24 const base::string16& app_name, |
22 const base::string16& target_name, | 25 const base::string16& target_name, |
23 std::unique_ptr<DesktopMediaList> screen_list, | 26 std::unique_ptr<DesktopMediaList> screen_list, |
24 std::unique_ptr<DesktopMediaList> window_list, | 27 std::unique_ptr<DesktopMediaList> window_list, |
25 std::unique_ptr<DesktopMediaList> tab_list, | 28 std::unique_ptr<DesktopMediaList> tab_list, |
26 bool request_audio, | 29 bool request_audio, |
27 const DoneCallback& done_callback) { | 30 const DoneCallback& done_callback) { |
| 31 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 32 extensions::switches::kDisableDesktopCapturePickerOldUI)) { |
| 33 controller_deprecated_.reset([[DesktopMediaPickerControllerDeprecated alloc] |
| 34 initWithScreenList:std::move(screen_list) |
| 35 windowList:std::move(window_list) |
| 36 tabList:std::move(tab_list) |
| 37 parent:parent |
| 38 callback:done_callback |
| 39 appName:app_name |
| 40 targetName:target_name |
| 41 requestAudio:request_audio]); |
| 42 [controller_deprecated_ showWindow:nil]; |
| 43 return; |
| 44 } |
| 45 |
28 controller_.reset([[DesktopMediaPickerController alloc] | 46 controller_.reset([[DesktopMediaPickerController alloc] |
29 initWithScreenList:std::move(screen_list) | 47 initWithScreenList:std::move(screen_list) |
30 windowList:std::move(window_list) | 48 windowList:std::move(window_list) |
31 tabList:std::move(tab_list) | 49 tabList:std::move(tab_list) |
32 parent:parent | 50 parent:parent |
33 callback:done_callback | 51 callback:done_callback |
34 appName:app_name | 52 appName:app_name |
35 targetName:target_name | 53 targetName:target_name |
36 requestAudio:request_audio]); | 54 requestAudio:request_audio]); |
37 [controller_ showWindow:nil]; | 55 [controller_ showWindow:nil]; |
38 } | 56 } |
39 | 57 |
40 // static | 58 // static |
41 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { | 59 std::unique_ptr<DesktopMediaPicker> DesktopMediaPicker::Create() { |
42 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerCocoa()); | 60 return std::unique_ptr<DesktopMediaPicker>(new DesktopMediaPickerCocoa()); |
43 } | 61 } |
OLD | NEW |