Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ |
| 6 #define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ | 6 #define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 class SingleReleaseCallback; | 23 class SingleReleaseCallback; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace gfx { | 26 namespace gfx { |
| 27 class Image; | 27 class Image; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Implementation of DesktopMediaList that shows native screens and | 30 // Implementation of DesktopMediaList that shows native screens and |
| 31 // native windows. | 31 // native windows. |
| 32 class DesktopMediaListAsh : public DesktopMediaList { | 32 class DesktopMediaListAsh : public DesktopMediaList { |
| 33 public: | 33 public: |
|
qiangchen
2015/12/07 22:45:56
Any reason to move SourceTypes to the parent class
GeorgeZ
2015/12/09 19:36:37
This definition once shared with a sibling class.
| |
| 34 enum SourceTypes { | |
| 35 SCREENS = 1, | |
| 36 WINDOWS = 2, | |
| 37 }; | |
| 38 | |
| 39 explicit DesktopMediaListAsh(int source_types); | 34 explicit DesktopMediaListAsh(int source_types); |
| 40 ~DesktopMediaListAsh() override; | 35 ~DesktopMediaListAsh() override; |
| 41 | 36 |
| 42 // DesktopMediaList interface. | 37 // DesktopMediaList interface. |
| 43 void SetUpdatePeriod(base::TimeDelta period) override; | 38 void SetUpdatePeriod(base::TimeDelta period) override; |
| 44 void SetThumbnailSize(const gfx::Size& thumbnail_size) override; | 39 void SetThumbnailSize(const gfx::Size& thumbnail_size) override; |
| 45 void StartUpdating(DesktopMediaListObserver* observer) override; | 40 void StartUpdating(DesktopMediaListObserver* observer) override; |
| 46 int GetSourceCount() const override; | 41 int GetSourceCount() const override; |
| 47 const Source& GetSource(int index) const override; | 42 const Source& GetSource(int index) const override; |
| 48 void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; | 43 void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; |
| 49 | 44 |
| 50 private: | 45 private: |
| 51 // Struct used to represent sources list the model gets from the Worker. | 46 // Struct used to represent sources list the model gets from the Worker. |
| 52 struct SourceDescription { | 47 struct SourceDescription { |
| 53 SourceDescription(content::DesktopMediaID id, const base::string16& name); | 48 SourceDescription(content::DesktopMediaID id, const base::string16& name); |
| 49 SourceDescription() = default; | |
| 54 | 50 |
| 55 content::DesktopMediaID id; | 51 content::DesktopMediaID id; |
| 56 base::string16 name; | 52 base::string16 name; |
| 53 gfx::ImageSkia thumbnail; | |
| 57 }; | 54 }; |
| 58 | 55 |
| 59 // Order comparator for sources. Used to sort list of sources. | 56 // Order comparator for sources. Used to sort list of sources. |
| 60 static bool CompareSources(const SourceDescription& a, | 57 static bool CompareSources(const SourceDescription& a, |
| 61 const SourceDescription& b); | 58 const SourceDescription& b); |
| 62 | 59 |
| 63 void Refresh(); | 60 void Refresh(); |
| 64 void EnumerateWindowsForRoot( | 61 void EnumerateWindowsForRoot( |
| 65 std::vector<DesktopMediaListAsh::SourceDescription>* windows, | 62 std::vector<DesktopMediaListAsh::SourceDescription>* windows, |
| 66 aura::Window* root_window, | 63 aura::Window* root_window, |
| 67 int container_id); | 64 int container_id); |
| 65 void EnumerateTabs( | |
| 66 std::vector<DesktopMediaListAsh::SourceDescription>* sources); | |
| 68 void EnumerateSources( | 67 void EnumerateSources( |
| 69 std::vector<DesktopMediaListAsh::SourceDescription>* windows); | 68 std::vector<DesktopMediaListAsh::SourceDescription>* windows); |
| 70 void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window); | 69 void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window); |
| 71 void OnThumbnailCaptured(content::DesktopMediaID id, | 70 void OnThumbnailCaptured(content::DesktopMediaID id, |
| 72 const gfx::Image& image); | 71 const gfx::Image& image); |
| 73 | 72 |
| 74 int source_types_; | 73 int source_types_; |
| 75 | 74 |
| 76 // Time interval between mode updates. | 75 // Time interval between mode updates. |
| 77 base::TimeDelta update_period_; | 76 base::TimeDelta update_period_; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 89 std::vector<Source> sources_; | 88 std::vector<Source> sources_; |
| 90 | 89 |
| 91 int pending_window_capture_requests_; | 90 int pending_window_capture_requests_; |
| 92 | 91 |
| 93 base::WeakPtrFactory<DesktopMediaListAsh> weak_factory_; | 92 base::WeakPtrFactory<DesktopMediaListAsh> weak_factory_; |
| 94 | 93 |
| 95 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListAsh); | 94 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListAsh); |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ | 97 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ |
| OLD | NEW |