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

Side by Side Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_base.h

Issue 1880693002: Desktop Capture Picker New UI: Preliminary Refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment Created 4 years, 8 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
OLDNEW
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_BASE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_BASE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_BASE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_BASE_H_
7 7
8 #include <array>
8 #include <map> 9 #include <map>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/memory/singleton.h" 12 #include "base/memory/singleton.h"
12 #include "chrome/browser/extensions/chrome_extension_function.h" 13 #include "chrome/browser/extensions/chrome_extension_function.h"
13 #include "chrome/browser/media/desktop_media_list.h" 14 #include "chrome/browser/media/desktop_media_list.h"
14 #include "chrome/browser/media/desktop_media_picker.h" 15 #include "chrome/browser/media/desktop_media_picker.h"
15 #include "chrome/common/extensions/api/desktop_capture.h" 16 #include "chrome/common/extensions/api/desktop_capture.h"
16 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 class DesktopCaptureChooseDesktopMediaFunctionBase 22 class DesktopCaptureChooseDesktopMediaFunctionBase
22 : public ChromeAsyncExtensionFunction, 23 : public ChromeAsyncExtensionFunction,
23 public content::WebContentsObserver { 24 public content::WebContentsObserver {
24 public: 25 public:
25 // Factory creating DesktopMediaList and DesktopMediaPicker instances. 26 // Factory creating DesktopMediaList and DesktopMediaPicker instances.
26 // Used for tests to supply fake picker. 27 // Used for tests to supply fake picker.
27 class PickerFactory { 28 class PickerFactory {
28 public: 29 public:
29 virtual std::unique_ptr<DesktopMediaList> CreateModel(bool show_screens, 30 virtual std::array<std::unique_ptr<DesktopMediaList>, 3> CreateModel(
Sergey Ulanov 2016/04/15 19:49:24 add a typedef for the result type?
qiangchen 2016/04/15 20:11:27 Done.
30 bool show_windows, 31 bool show_screens,
31 bool show_tabs, 32 bool show_windows,
32 bool show_audio) = 0; 33 bool show_tabs,
34 bool show_audio) = 0;
33 virtual std::unique_ptr<DesktopMediaPicker> CreatePicker() = 0; 35 virtual std::unique_ptr<DesktopMediaPicker> CreatePicker() = 0;
34 36
35 protected: 37 protected:
36 virtual ~PickerFactory() {} 38 virtual ~PickerFactory() {}
37 }; 39 };
38 40
39 // Used to set PickerFactory used to create mock DesktopMediaPicker instances 41 // Used to set PickerFactory used to create mock DesktopMediaPicker instances
40 // for tests. Calling tests keep ownership of the factory. Can be called with 42 // for tests. Calling tests keep ownership of the factory. Can be called with
41 // |factory| set to NULL at the end of the test. 43 // |factory| set to NULL at the end of the test.
42 static void SetPickerFactoryForTests(PickerFactory* factory); 44 static void SetPickerFactoryForTests(PickerFactory* factory);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 std::map<RequestId, DesktopCaptureChooseDesktopMediaFunctionBase*>; 118 std::map<RequestId, DesktopCaptureChooseDesktopMediaFunctionBase*>;
117 119
118 RequestsMap requests_; 120 RequestsMap requests_;
119 121
120 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureRequestsRegistry); 122 DISALLOW_COPY_AND_ASSIGN(DesktopCaptureRequestsRegistry);
121 }; 123 };
122 124
123 } // namespace extensions 125 } // namespace extensions
124 126
125 #endif // CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_BASE_H_ 127 #endif // CHROME_BROWSER_EXTENSIONS_API_DESKTOP_CAPTURE_DESKTOP_CAPTURE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698