Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1607)

Unified Diff: chrome/browser/media/desktop_media_picker_model.h

Issue 23447012: Add interface for DesktopMediaPickerModel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed DISALLOW_ASSIGN. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6b936bfe42a246dc7d0ac8156d7183c486096593 100644
--- a/chrome/browser/media/desktop_media_picker_model.h
+++ b/chrome/browser/media/desktop_media_picker_model.h
@@ -49,32 +49,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();
+ 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;
+};
- int source_count() const { return sources_.size(); }
- const Source& source(int index) const { return sources_.at(index); }
+class DesktopMediaPickerModelImpl : public DesktopMediaPickerModel {
+ 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).
+ DesktopMediaPickerModelImpl(
+ scoped_ptr<webrtc::ScreenCapturer> screen_capturer,
+ scoped_ptr<webrtc::WindowCapturer> window_capturer);
+ virtual ~DesktopMediaPickerModelImpl();
+
+ // 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;
@@ -127,9 +140,9 @@ class DesktopMediaPickerModel {
// Current list of sources.
std::vector<Source> sources_;
- base::WeakPtrFactory<DesktopMediaPickerModel> weak_factory_;
+ base::WeakPtrFactory<DesktopMediaPickerModelImpl> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerModel);
+ DISALLOW_COPY_AND_ASSIGN(DesktopMediaPickerModelImpl);
};
#endif // CHROME_BROWSER_MEDIA_DESKTOP_MEDIA_PICKER_MODEL_H_

Powered by Google App Engine
This is Rietveld 408576698