| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 
| 6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 
| 7 | 7 | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <string> | 10 #include <string> | 
| 11 #include <vector> | 11 #include <vector> | 
| 12 | 12 | 
| 13 #include "base/macros.h" | 13 #include "base/macros.h" | 
| 14 | 14 | 
| 15 namespace display { | 15 namespace display { | 
| 16 class Display; | 16 class Display; | 
| 17 } | 17 } | 
| 18 | 18 | 
| 19 namespace extensions { | 19 namespace extensions { | 
| 20 | 20 | 
| 21 namespace api { | 21 namespace api { | 
| 22 namespace system_display { | 22 namespace system_display { | 
|  | 23 struct DisplayLayout; | 
| 23 struct DisplayProperties; | 24 struct DisplayProperties; | 
| 24 struct DisplayUnitInfo; | 25 struct DisplayUnitInfo; | 
| 25 struct Insets; | 26 struct Insets; | 
| 26 } | 27 } | 
| 27 } | 28 } | 
| 28 | 29 | 
| 29 typedef std::vector<api::system_display::DisplayUnitInfo> DisplayUnitInfoList; |  | 
| 30 |  | 
| 31 class DisplayInfoProvider { | 30 class DisplayInfoProvider { | 
| 32  public: | 31  public: | 
|  | 32   using DisplayUnitInfoList = std::vector<api::system_display::DisplayUnitInfo>; | 
|  | 33   using DisplayLayoutList = std::vector<api::system_display::DisplayLayout>; | 
|  | 34 | 
| 33   virtual ~DisplayInfoProvider(); | 35   virtual ~DisplayInfoProvider(); | 
| 34 | 36 | 
| 35   // Returns a pointer to DisplayInfoProvider or NULL if Create() | 37   // Returns a pointer to DisplayInfoProvider or NULL if Create() | 
| 36   // or InitializeForTesting() or not called yet. | 38   // or InitializeForTesting() or not called yet. | 
| 37   static DisplayInfoProvider* Get(); | 39   static DisplayInfoProvider* Get(); | 
| 38 | 40 | 
| 39   // This is for tests that run in its own process (e.g. browser_tests). | 41   // This is for tests that run in its own process (e.g. browser_tests). | 
| 40   // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. | 42   // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. | 
| 41   static void InitializeForTesting(DisplayInfoProvider* display_info_provider); | 43   static void InitializeForTesting(DisplayInfoProvider* display_info_provider); | 
| 42 | 44 | 
| 43   // Updates the display with |display_id| according to |info|. Returns whether | 45   // Updates the display with |display_id| according to |info|. Returns whether | 
| 44   // the display was successfully updated. On failure, no display parameters | 46   // the display was successfully updated. On failure, no display parameters | 
| 45   // should be changed, and |error| should be set to the error string. | 47   // should be changed, and |error| should be set to the error string. | 
| 46   virtual bool SetInfo(const std::string& display_id, | 48   virtual bool SetInfo(const std::string& display_id, | 
| 47                        const api::system_display::DisplayProperties& info, | 49                        const api::system_display::DisplayProperties& info, | 
| 48                        std::string* error) = 0; | 50                        std::string* error) = 0; | 
| 49 | 51 | 
| 50   // Enable the unified desktop feature. | 52   // Implements SetDisplayLayout methods. See system_display.idl. Returns | 
|  | 53   // false if the layout input is invalid. | 
|  | 54   virtual bool SetDisplayLayout(const DisplayLayoutList& layouts); | 
|  | 55 | 
|  | 56   // Enables the unified desktop feature. | 
| 51   virtual void EnableUnifiedDesktop(bool enable); | 57   virtual void EnableUnifiedDesktop(bool enable); | 
| 52 | 58 | 
| 53   // Get display information. | 59   // Gets display information. | 
| 54   virtual DisplayUnitInfoList GetAllDisplaysInfo(); | 60   virtual DisplayUnitInfoList GetAllDisplaysInfo(); | 
| 55 | 61 | 
| 56   // Implement overscan calbiration methods. See system_display.idl. These | 62   // Gets display layout information. | 
|  | 63   virtual DisplayLayoutList GetDisplayLayout(); | 
|  | 64 | 
|  | 65   // Implements overscan calbiration methods. See system_display.idl. These | 
| 57   // return false if |id| is invalid. | 66   // return false if |id| is invalid. | 
| 58   virtual bool OverscanCalibrationStart(const std::string& id); | 67   virtual bool OverscanCalibrationStart(const std::string& id); | 
| 59   virtual bool OverscanCalibrationAdjust( | 68   virtual bool OverscanCalibrationAdjust( | 
| 60       const std::string& id, | 69       const std::string& id, | 
| 61       const api::system_display::Insets& delta); | 70       const api::system_display::Insets& delta); | 
| 62   virtual bool OverscanCalibrationReset(const std::string& id); | 71   virtual bool OverscanCalibrationReset(const std::string& id); | 
| 63   virtual bool OverscanCalibrationComplete(const std::string& id); | 72   virtual bool OverscanCalibrationComplete(const std::string& id); | 
| 64 | 73 | 
| 65  protected: | 74  protected: | 
| 66   DisplayInfoProvider(); | 75   DisplayInfoProvider(); | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 79   virtual void UpdateDisplayUnitInfoForPlatform( | 88   virtual void UpdateDisplayUnitInfoForPlatform( | 
| 80       const display::Display& display, | 89       const display::Display& display, | 
| 81       api::system_display::DisplayUnitInfo* unit) = 0; | 90       api::system_display::DisplayUnitInfo* unit) = 0; | 
| 82 | 91 | 
| 83   DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); | 92   DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); | 
| 84 }; | 93 }; | 
| 85 | 94 | 
| 86 }  // namespace extensions | 95 }  // namespace extensions | 
| 87 | 96 | 
| 88 #endif  // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 97 #endif  // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 
| OLD | NEW | 
|---|