Chromium Code Reviews| Index: chrome/browser/media/desktop_media_picker_model.h |
| diff --git a/chrome/browser/media/desktop_media_picker_model.h b/chrome/browser/media/desktop_media_picker_model.h |
| index 7773c3d9476b8aa8f6e687760ca9722c019f5c52..4cdbe838a40dadc86abb3e3fd0c15eaab08d1ecd 100644 |
| --- a/chrome/browser/media/desktop_media_picker_model.h |
| +++ b/chrome/browser/media/desktop_media_picker_model.h |
| @@ -17,12 +17,14 @@ class ScreenCapturer; |
| class WindowCapturer; |
| } |
| -// DesktopMediaPickerModel provides the list of desktop media source (screens, |
| -// windows, tabs), and their thumbnails, to the desktop media picker dialog. It |
| -// transparently updates the list in the background, and notifies the desktop |
| -// media picker when something changes. |
| -class DesktopMediaPickerModel { |
| +// Interface for DesktopMediaPickerModel, which provides the list of desktop |
| +// media source (screens, windows, tabs), and their thumbnails, to the desktop |
| +// media picker dialog. It transparently updates the list in the background, and |
| +// notifies the desktop media picker when something changes. |
| +class DesktopMediaPickerModelInterface { |
|
Sergey Ulanov
2013/09/04 20:39:00
We don't normally use "Interface" suffix in chromi
dcaiafa
2013/09/04 22:41:38
Done.
|
| public: |
| + virtual ~DesktopMediaPickerModelInterface() {} |
| + |
| // Interface implemented by the picker dialog to receive notifications when |
| // the model's contents change. |
| class Observer { |
| @@ -49,32 +51,45 @@ class DesktopMediaPickerModel { |
| gfx::ImageSkia thumbnail; |
| }; |
| - // Caller may pass NULL for either of the arguments in case when only some |
| - // types of sources the model should be populated with (e.g. it will only |
| - // contain windows, if |screen_capturer| is NULL). |
| - DesktopMediaPickerModel(scoped_ptr<webrtc::ScreenCapturer> screen_capturer, |
| - scoped_ptr<webrtc::WindowCapturer> window_capturer); |
| - virtual ~DesktopMediaPickerModel(); |
| - |
| // Sets time interval between updates. By default list of sources and their |
| // thumbnail are updated once per second. If called after StartUpdating() then |
| // it will take effect only after the next update. |
| - void SetUpdatePeriod(base::TimeDelta period); |
| + virtual void SetUpdatePeriod(base::TimeDelta period) = 0; |
| // Sets size to which the thumbnails should be scaled. If called after |
| // StartUpdating() then some thumbnails may be still scaled to the old size |
| // until they are updated. |
| - void SetThumbnailSize(const gfx::Size& thumbnail_size); |
| + virtual void SetThumbnailSize(const gfx::Size& thumbnail_size) = 0; |
| // Starts updating the model. The model is initially empty, so OnSourceAdded() |
| // notifications will be generated for each existing source as it is |
| // enumerated. After the initial enumeration the model will be refreshed based |
| // on the update period, and notifications generated only for changes in the |
| // model. |
| - void StartUpdating(Observer* observer); |
| + virtual void StartUpdating(Observer* observer) = 0; |
| + |
| + virtual int source_count() const = 0; |
| + virtual const Source& source(int index) const = 0; |
| + |
| + private: |
| + DISALLOW_ASSIGN(DesktopMediaPickerModelInterface); |
| +}; |
| + |
| +class DesktopMediaPickerModel : public DesktopMediaPickerModelInterface { |
| + public: |
| + // Caller may pass NULL for either of the arguments in case when only some |
| + // types of sources the model should be populated with (e.g. it will only |
| + // contain windows, if |screen_capturer| is NULL). |
| + DesktopMediaPickerModel(scoped_ptr<webrtc::ScreenCapturer> screen_capturer, |
| + scoped_ptr<webrtc::WindowCapturer> window_capturer); |
| + virtual ~DesktopMediaPickerModel(); |
| - int source_count() const { return sources_.size(); } |
| - const Source& source(int index) const { return sources_.at(index); } |
| + // DesktopMediaPickerModelInterface: |
| + virtual void SetUpdatePeriod(base::TimeDelta period) OVERRIDE; |
| + virtual void SetThumbnailSize(const gfx::Size& thumbnail_size) OVERRIDE; |
| + virtual void StartUpdating(Observer* observer) OVERRIDE; |
| + virtual int source_count() const OVERRIDE; |
| + virtual const Source& source(int index) const OVERRIDE; |
| private: |
| class Worker; |