OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BASE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_BASE_H_ |
6 #define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_BASE_H_ | 6 #define CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_BASE_H_ |
7 | 7 |
8 #include "chrome/browser/media/desktop_media_list.h" | 8 #include "chrome/browser/media/desktop_media_list.h" |
9 #include "content/public/browser/desktop_media_id.h" | 9 #include "content/public/browser/desktop_media_id.h" |
10 | 10 |
| 11 namespace gfx { |
| 12 class Image; |
| 13 } |
| 14 |
11 // Thumbnail size is 100*100 pixels | 15 // Thumbnail size is 100*100 pixels |
12 static const int kDefaultThumbnailSize = 100; | 16 static const int kDefaultThumbnailSize = 100; |
13 | 17 |
14 // Base class for DesktopMediaList implementations. Implements logic shared | 18 // Base class for DesktopMediaList implementations. Implements logic shared |
15 // between implementations. Specifically it's responsible for keeping current | 19 // between implementations. Specifically it's responsible for keeping current |
16 // list of sources and calling the observer when the list changes. | 20 // list of sources and calling the observer when the list changes. |
17 class DesktopMediaListBase : public DesktopMediaList { | 21 class DesktopMediaListBase : public DesktopMediaList { |
18 public: | 22 public: |
19 explicit DesktopMediaListBase(base::TimeDelta update_period); | 23 explicit DesktopMediaListBase(base::TimeDelta update_period); |
20 ~DesktopMediaListBase() override; | 24 ~DesktopMediaListBase() override; |
21 | 25 |
22 // DesktopMediaList interface. | 26 // DesktopMediaList interface. |
23 void SetUpdatePeriod(base::TimeDelta period) override; | 27 void SetUpdatePeriod(base::TimeDelta period) override; |
24 void SetThumbnailSize(const gfx::Size& thumbnail_size) override; | 28 void SetThumbnailSize(const gfx::Size& thumbnail_size) override; |
25 void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; | 29 void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override; |
26 void StartUpdating(DesktopMediaListObserver* observer) override; | 30 void StartUpdating(DesktopMediaListObserver* observer) override; |
27 int GetSourceCount() const override; | 31 int GetSourceCount() const override; |
28 const Source& GetSource(int index) const override; | 32 const Source& GetSource(int index) const override; |
29 | 33 |
| 34 static uint32_t GetImageHash(const gfx::Image& image); |
| 35 |
30 protected: | 36 protected: |
31 struct SourceDescription { | 37 struct SourceDescription { |
32 SourceDescription(content::DesktopMediaID id, const base::string16& name); | 38 SourceDescription(content::DesktopMediaID id, const base::string16& name); |
33 | 39 |
34 content::DesktopMediaID id; | 40 content::DesktopMediaID id; |
35 base::string16 name; | 41 base::string16 name; |
36 }; | 42 }; |
37 | 43 |
38 virtual void Refresh() = 0; | 44 virtual void Refresh() = 0; |
39 | 45 |
(...skipping 24 matching lines...) Expand all Loading... |
64 | 70 |
65 // The observer passed to StartUpdating(). | 71 // The observer passed to StartUpdating(). |
66 DesktopMediaListObserver* observer_ = nullptr; | 72 DesktopMediaListObserver* observer_ = nullptr; |
67 | 73 |
68 base::WeakPtrFactory<DesktopMediaListBase> weak_factory_; | 74 base::WeakPtrFactory<DesktopMediaListBase> weak_factory_; |
69 | 75 |
70 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListBase); | 76 DISALLOW_COPY_AND_ASSIGN(DesktopMediaListBase); |
71 }; | 77 }; |
72 | 78 |
73 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_BASE_H_ | 79 #endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_LIST_BASE_H_ |
OLD | NEW |