| 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 13 matching lines...) Expand all Loading... |
| 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: |
| 34 enum SourceTypes { | 34 enum SourceTypes { SCREENS = 1, WINDOWS = 2, TABS = 4 }; |
| 35 SCREENS = 1, | |
| 36 WINDOWS = 2, | |
| 37 }; | |
| 38 | |
| 39 explicit DesktopMediaListAsh(int source_types); | 35 explicit DesktopMediaListAsh(int source_types); |
| 40 ~DesktopMediaListAsh() override; | 36 ~DesktopMediaListAsh() override; |
| 41 | 37 |
| 42 // DesktopMediaList interface. | 38 // DesktopMediaList interface. |
| 43 void SetUpdatePeriod(base::TimeDelta period) override; | 39 void SetUpdatePeriod(base::TimeDelta period) override; |
| 44 void SetThumbnailSize(const gfx::Size& thumbnail_size) override; | 40 void SetThumbnailSize(const gfx::Size& thumbnail_size) override; |
| 45 void StartUpdating(DesktopMediaListObserver* observer) override; | 41 void StartUpdating(DesktopMediaListObserver* observer) override; |
| 46 int GetSourceCount() const override; | 42 int GetSourceCount() const override; |
| 47 const Source& GetSource(int index) const override; | 43 const Source& GetSource(int index) const override; |
| 48 void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; | 44 void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; |
| 49 | 45 |
| 50 private: | 46 private: |
| 51 // Struct used to represent sources list the model gets from the Worker. | 47 // Struct used to represent sources list the model gets from the Worker. |
| 52 struct SourceDescription { | 48 struct SourceDescription { |
| 53 SourceDescription(content::DesktopMediaID id, const base::string16& name); | 49 SourceDescription(content::DesktopMediaID id, const base::string16& name); |
| 50 SourceDescription() = default; |
| 54 | 51 |
| 55 content::DesktopMediaID id; | 52 content::DesktopMediaID id; |
| 56 base::string16 name; | 53 base::string16 name; |
| 54 gfx::ImageSkia thumbnail; |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 // Order comparator for sources. Used to sort list of sources. | 57 // Order comparator for sources. Used to sort list of sources. |
| 60 static bool CompareSources(const SourceDescription& a, | 58 static bool CompareSources(const SourceDescription& a, |
| 61 const SourceDescription& b); | 59 const SourceDescription& b); |
| 62 | 60 |
| 63 void Refresh(); | 61 void Refresh(); |
| 64 void EnumerateWindowsForRoot( | 62 void EnumerateWindowsForRoot( |
| 65 std::vector<DesktopMediaListAsh::SourceDescription>* windows, | 63 std::vector<DesktopMediaListAsh::SourceDescription>* windows, |
| 66 aura::Window* root_window, | 64 aura::Window* root_window, |
| 67 int container_id); | 65 int container_id); |
| 66 void EnumerateTabs( |
| 67 std::vector<DesktopMediaListAsh::SourceDescription>* sources); |
| 68 void EnumerateSources( | 68 void EnumerateSources( |
| 69 std::vector<DesktopMediaListAsh::SourceDescription>* windows); | 69 std::vector<DesktopMediaListAsh::SourceDescription>* windows); |
| 70 void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window); | 70 void CaptureThumbnail(content::DesktopMediaID id, aura::Window* window); |
| 71 void OnThumbnailCaptured(content::DesktopMediaID id, | 71 void OnThumbnailCaptured(content::DesktopMediaID id, |
| 72 const gfx::Image& image); | 72 const gfx::Image& image); |
| 73 | 73 |
| 74 int source_types_; | 74 int source_types_; |
| 75 | 75 |
| 76 // Time interval between mode updates. | 76 // Time interval between mode updates. |
| 77 base::TimeDelta update_period_; | 77 base::TimeDelta update_period_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 89 std::vector<Source> sources_; | 89 std::vector<Source> sources_; |
| 90 | 90 |
| 91 int pending_window_capture_requests_; | 91 int pending_window_capture_requests_; |
| 92 | 92 |
| 93 base::WeakPtrFactory<DesktopMediaListAsh> weak_factory_; | 93 base::WeakPtrFactory<DesktopMediaListAsh> weak_factory_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListAsh); | 95 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListAsh); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ | 98 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_ASH_H_ |
| OLD | NEW |