No dual_mode on Win10+ shortcuts.
[chromium-blink-merge.git] / chrome / browser / media / desktop_media_list_ash.h
blob2f35ea0a3748072cf1ddcc25da5297f3e33ab3bc
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_
6 #define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/sequenced_task_runner.h"
12 #include "chrome/browser/media/desktop_media_list.h"
13 #include "content/public/browser/desktop_media_id.h"
15 class SkBitmap;
17 namespace aura {
18 class Window;
21 namespace cc {
22 class CopyOutputResult;
23 class SingleReleaseCallback;
26 namespace gfx {
27 class Image;
30 // Implementation of DesktopMediaList that shows native screens and
31 // native windows.
32 class DesktopMediaListAsh : public DesktopMediaList {
33 public:
34 enum SourceTypes {
35 SCREENS = 1,
36 WINDOWS = 2,
39 explicit DesktopMediaListAsh(int source_types);
40 ~DesktopMediaListAsh() override;
42 // DesktopMediaList interface.
43 void SetUpdatePeriod(base::TimeDelta period) override;
44 void SetThumbnailSize(const gfx::Size& thumbnail_size) override;
45 void StartUpdating(DesktopMediaListObserver* observer) override;
46 int GetSourceCount() const override;
47 const Source& GetSource(int index) const override;
48 void SetViewDialogWindowId(content::DesktopMediaID::Id dialog_id) override;
50 private:
51 // Struct used to represent sources list the model gets from the Worker.
52 struct SourceDescription {
53 SourceDescription(content::DesktopMediaID id, const base::string16& name);
55 content::DesktopMediaID id;
56 base::string16 name;
59 // Order comparator for sources. Used to sort list of sources.
60 static bool CompareSources(const SourceDescription& a,
61 const SourceDescription& b);
63 void Refresh();
64 void EnumerateWindowsForRoot(
65 std::vector<DesktopMediaListAsh::SourceDescription>* windows,
66 aura::Window* root_window,
67 int container_id);
68 void EnumerateSources(
69 std::vector<DesktopMediaListAsh::SourceDescription>* windows);
70 void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window);
71 void OnThumbnailCaptured(content::DesktopMediaID id,
72 const gfx::Image& image);
74 int source_types_;
76 // Time interval between mode updates.
77 base::TimeDelta update_period_;
79 // Size of thumbnails generated by the model.
80 gfx::Size thumbnail_size_;
82 // ID of the hosting dialog.
83 content::DesktopMediaID::Id view_dialog_id_;
85 // The observer passed to StartUpdating().
86 DesktopMediaListObserver* observer_;
88 // Current list of sources.
89 std::vector<Source> sources_;
91 int pending_window_capture_requests_;
93 base::WeakPtrFactory<DesktopMediaListAsh> weak_factory_;
95 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListAsh);
98 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_