Index: chrome/browser/extensions/api/system_display/display_info_provider.h |
diff --git a/chrome/browser/extensions/api/system_display/display_info_provider.h b/chrome/browser/extensions/api/system_display/display_info_provider.h |
index 50eec2e0d1484401959ee65922f0fbdbbac4f27c..bf578de590a10405aa8e2434416adb7f5b3fd7ed 100644 |
--- a/chrome/browser/extensions/api/system_display/display_info_provider.h |
+++ b/chrome/browser/extensions/api/system_display/display_info_provider.h |
@@ -8,7 +8,8 @@ |
#include <string> |
#include <vector> |
-#include "chrome/common/extensions/api/system_display.h" |
+#include "base/macros.h" |
+#include "base/memory/linked_ptr.h" |
namespace gfx { |
class Display; |
@@ -16,32 +17,48 @@ class Display; |
namespace extensions { |
-typedef std::vector<linked_ptr< |
- api::system_display::DisplayUnitInfo> > DisplayInfo; |
+namespace api { |
+namespace system_display { |
+struct DisplayProperties; |
+struct DisplayUnitInfo; |
+} |
+} |
-class DisplayInfoProvider { |
- public : |
- static DisplayInfoProvider* Get(); |
+typedef std::vector<linked_ptr<api::system_display::DisplayUnitInfo> > |
+ DisplayInfo; |
- DisplayInfoProvider(); |
+class DisplayInfoProvider { |
+ public: |
virtual ~DisplayInfoProvider(); |
+ // Returns a pointer to DisplayInfoProvider or NULL if Create() |
+ // or InitializeForTesting() or not called yet. |
James Cook
2014/08/19 21:48:51
This isn't true -- it creates a new one if it does
|
+ static DisplayInfoProvider* Get(); |
+ |
// This is for tests that run in its own process (e.g. browser_tests). |
// Using this in other tests (e.g. unit_tests) will result in DCHECK failure. |
static void InitializeForTesting(DisplayInfoProvider* display_info_provider); |
- DisplayInfo GetAllDisplaysInfo(); |
- |
+ // Updates the display with |display_id| according to |info|. Returns whether |
+ // the display was successfully updated. On failure, no display parameters |
+ // should be changed, and |error| should be set to the error string. |
virtual bool SetInfo(const std::string& display_id, |
const api::system_display::DisplayProperties& info, |
- std::string* error); |
+ std::string* error) = 0; |
+ |
+ DisplayInfo GetAllDisplaysInfo(); |
+ |
+ protected: |
+ DisplayInfoProvider(); |
private: |
+ static DisplayInfoProvider* Create(); |
+ |
// Update the content of the |unit| obtained for |display| using |
// platform specific method. |
virtual void UpdateDisplayUnitInfoForPlatform( |
const gfx::Display& display, |
- extensions::api::system_display::DisplayUnitInfo* unit); |
+ api::system_display::DisplayUnitInfo* unit) = 0; |
DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); |
}; |