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/extensions/api/desktop_capture/desktop_capture_api.h" | 5 #include "chrome/browser/extensions/api/desktop_capture/desktop_capture_api.h" |
6 | 6 |
| 7 #include "base/compiler_specific.h" |
7 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/media/desktop_streams_registry.h" | 9 #include "chrome/browser/media/desktop_streams_registry.h" |
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
10 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
11 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 12 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
12 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" | 13 #include "third_party/webrtc/modules/desktop_capture/window_capturer.h" |
13 | 14 |
14 namespace extensions { | 15 namespace extensions { |
15 | 16 |
16 namespace { | 17 namespace { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } else { | 81 } else { |
81 origin_ = GetExtension()->url(); | 82 origin_ = GetExtension()->url(); |
82 } | 83 } |
83 | 84 |
84 scoped_ptr<DesktopMediaPickerModel> model; | 85 scoped_ptr<DesktopMediaPickerModel> model; |
85 if (g_picker_factory) { | 86 if (g_picker_factory) { |
86 model = g_picker_factory->CreateModel( | 87 model = g_picker_factory->CreateModel( |
87 screen_capturer.Pass(), window_capturer.Pass()); | 88 screen_capturer.Pass(), window_capturer.Pass()); |
88 picker_ = g_picker_factory->CreatePicker(); | 89 picker_ = g_picker_factory->CreatePicker(); |
89 } else { | 90 } else { |
90 // Currently DesktopMediaPicker is implemented only for platforms that | 91 // DesktopMediaPicker is not implented for all platforms yet. |
91 // use Views. | 92 #if defined(TOOLKIT_VIEWS) || defined(OS_MACOSX) |
92 #if defined(TOOLKIT_VIEWS) | |
93 model.reset(new DesktopMediaPickerModelImpl( | 93 model.reset(new DesktopMediaPickerModelImpl( |
94 screen_capturer.Pass(), window_capturer.Pass())); | 94 screen_capturer.Pass(), window_capturer.Pass())); |
95 picker_ = DesktopMediaPicker::Create(); | 95 picker_ = DesktopMediaPicker::Create(); |
96 #else | 96 #else |
97 error_ = kNotImplementedError; | 97 error_ = kNotImplementedError; |
98 return false; | 98 return false; |
99 #endif | 99 #endif |
100 } | 100 } |
101 DesktopMediaPicker::DoneCallback callback = base::Bind( | 101 DesktopMediaPicker::DoneCallback callback = base::Bind( |
102 &DesktopCaptureChooseDesktopMediaFunction::OnPickerDialogResults, this); | 102 &DesktopCaptureChooseDesktopMediaFunction::OnPickerDialogResults, this); |
(...skipping 10 matching lines...) Expand all Loading... |
113 MediaCaptureDevicesDispatcher::GetInstance()-> | 113 MediaCaptureDevicesDispatcher::GetInstance()-> |
114 GetDesktopStreamsRegistry(); | 114 GetDesktopStreamsRegistry(); |
115 result = registry->RegisterStream(origin_, source); | 115 result = registry->RegisterStream(origin_, source); |
116 } | 116 } |
117 | 117 |
118 SetResult(new base::StringValue(result)); | 118 SetResult(new base::StringValue(result)); |
119 SendResponse(true); | 119 SendResponse(true); |
120 } | 120 } |
121 | 121 |
122 } // namespace extensions | 122 } // namespace extensions |
OLD | NEW |