Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(637)

Side by Side Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_api.cc

Issue 23447012: Add interface for DesktopMediaPickerModel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed DISALLOW_ASSIGN. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/media/desktop_streams_registry.h" 8 #include "chrome/browser/media/desktop_streams_registry.h"
9 #include "chrome/browser/media/media_capture_devices_dispatcher.h" 9 #include "chrome/browser/media/media_capture_devices_dispatcher.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 scoped_ptr<DesktopMediaPickerModel> model; 84 scoped_ptr<DesktopMediaPickerModel> model;
85 if (g_picker_factory) { 85 if (g_picker_factory) {
86 model = g_picker_factory->CreateModel( 86 model = g_picker_factory->CreateModel(
87 screen_capturer.Pass(), window_capturer.Pass()); 87 screen_capturer.Pass(), window_capturer.Pass());
88 picker_ = g_picker_factory->CreatePicker(); 88 picker_ = g_picker_factory->CreatePicker();
89 } else { 89 } else {
90 // Currently DesktopMediaPicker is implemented only for platforms that 90 // Currently DesktopMediaPicker is implemented only for platforms that
91 // use Views. 91 // use Views.
92 #if defined(TOOLKIT_VIEWS) 92 #if defined(TOOLKIT_VIEWS)
93 model.reset(new DesktopMediaPickerModel( 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);
103 picker_->Show(NULL, NULL, UTF8ToUTF16(GetExtension()->name()), 103 picker_->Show(NULL, NULL, UTF8ToUTF16(GetExtension()->name()),
104 model.Pass(), callback); 104 model.Pass(), callback);
105 return true; 105 return true;
106 } 106 }
107 107
108 void DesktopCaptureChooseDesktopMediaFunction::OnPickerDialogResults( 108 void DesktopCaptureChooseDesktopMediaFunction::OnPickerDialogResults(
109 content::DesktopMediaID source) { 109 content::DesktopMediaID source) {
110 std::string result; 110 std::string result;
111 if (source.type != content::DesktopMediaID::TYPE_NONE) { 111 if (source.type != content::DesktopMediaID::TYPE_NONE) {
112 DesktopStreamsRegistry* registry = 112 DesktopStreamsRegistry* registry =
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698