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