| 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/callback_forward.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 | 15 |
| 15 namespace display { | 16 namespace display { |
| 16 class Display; | 17 class Display; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace extensions { | 20 namespace extensions { |
| 20 | 21 |
| 21 namespace api { | 22 namespace api { |
| 22 namespace system_display { | 23 namespace system_display { |
| 23 struct Bounds; | 24 struct Bounds; |
| 24 struct DisplayLayout; | 25 struct DisplayLayout; |
| 25 struct DisplayProperties; | 26 struct DisplayProperties; |
| 26 struct DisplayUnitInfo; | 27 struct DisplayUnitInfo; |
| 27 struct Insets; | 28 struct Insets; |
| 28 struct TouchCalibrationPairQuad; | 29 struct TouchCalibrationPairQuad; |
| 29 } | 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 32 class DisplayInfoProvider { | 33 class DisplayInfoProvider { |
| 33 public: | 34 public: |
| 34 using DisplayUnitInfoList = std::vector<api::system_display::DisplayUnitInfo>; | 35 using DisplayUnitInfoList = std::vector<api::system_display::DisplayUnitInfo>; |
| 35 using DisplayLayoutList = std::vector<api::system_display::DisplayLayout>; | 36 using DisplayLayoutList = std::vector<api::system_display::DisplayLayout>; |
| 37 using TouchCalibrationCallback = base::Callback<void(bool)>; |
| 36 | 38 |
| 37 virtual ~DisplayInfoProvider(); | 39 virtual ~DisplayInfoProvider(); |
| 38 | 40 |
| 39 // Returns a pointer to DisplayInfoProvider or NULL if Create() | 41 // Returns a pointer to DisplayInfoProvider or NULL if Create() |
| 40 // or InitializeForTesting() or not called yet. | 42 // or InitializeForTesting() or not called yet. |
| 41 static DisplayInfoProvider* Get(); | 43 static DisplayInfoProvider* Get(); |
| 42 | 44 |
| 43 // This is for tests that run in its own process (e.g. browser_tests). | 45 // This is for tests that run in its own process (e.g. browser_tests). |
| 44 // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. | 46 // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. |
| 45 static void InitializeForTesting(DisplayInfoProvider* display_info_provider); | 47 static void InitializeForTesting(DisplayInfoProvider* display_info_provider); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 67 // Implements overscan calbiration methods. See system_display.idl. These | 69 // Implements overscan calbiration methods. See system_display.idl. These |
| 68 // return false if |id| is invalid. | 70 // return false if |id| is invalid. |
| 69 virtual bool OverscanCalibrationStart(const std::string& id); | 71 virtual bool OverscanCalibrationStart(const std::string& id); |
| 70 virtual bool OverscanCalibrationAdjust( | 72 virtual bool OverscanCalibrationAdjust( |
| 71 const std::string& id, | 73 const std::string& id, |
| 72 const api::system_display::Insets& delta); | 74 const api::system_display::Insets& delta); |
| 73 virtual bool OverscanCalibrationReset(const std::string& id); | 75 virtual bool OverscanCalibrationReset(const std::string& id); |
| 74 virtual bool OverscanCalibrationComplete(const std::string& id); | 76 virtual bool OverscanCalibrationComplete(const std::string& id); |
| 75 | 77 |
| 76 // Implements touch calibration methods. See system_display.idl. This returns | 78 // Implements touch calibration methods. See system_display.idl. This returns |
| 77 // false if |id| is invalid. | 79 // false in case any error occurs. In such cases the |error| string will also |
| 78 virtual bool TouchCalibrationStart(const std::string& id); | 80 // be set. |
| 79 virtual bool TouchCalibrationSet( | 81 virtual bool ShowNativeTouchCalibration( |
| 80 const std::string& id, | 82 const std::string& id, |
| 83 std::string* error, |
| 84 const TouchCalibrationCallback& callback); |
| 85 virtual bool StartCustomTouchCalibration(const std::string& id, |
| 86 std::string* error); |
| 87 virtual bool CompleteCustomTouchCalibration( |
| 81 const api::system_display::TouchCalibrationPairQuad& pairs, | 88 const api::system_display::TouchCalibrationPairQuad& pairs, |
| 82 const api::system_display::Bounds& bounds, | 89 const api::system_display::Bounds& bounds, |
| 83 std::string* error); | 90 std::string* error); |
| 84 virtual bool TouchCalibrationReset(const std::string& id, std::string* error); | 91 virtual bool ClearTouchCalibration(const std::string& id, std::string* error); |
| 85 virtual bool IsTouchCalibrationActive(std::string* error); | 92 virtual bool IsNativeTouchCalibrationActive(std::string* error); |
| 86 | 93 |
| 87 protected: | 94 protected: |
| 88 DisplayInfoProvider(); | 95 DisplayInfoProvider(); |
| 89 | 96 |
| 90 // Create a DisplayUnitInfo from a display::Display for implementations of | 97 // Create a DisplayUnitInfo from a display::Display for implementations of |
| 91 // GetAllDisplaysInfo() | 98 // GetAllDisplaysInfo() |
| 92 static api::system_display::DisplayUnitInfo CreateDisplayUnitInfo( | 99 static api::system_display::DisplayUnitInfo CreateDisplayUnitInfo( |
| 93 const display::Display& display, | 100 const display::Display& display, |
| 94 int64_t primary_display_id); | 101 int64_t primary_display_id); |
| 95 | 102 |
| 96 private: | 103 private: |
| 97 static DisplayInfoProvider* Create(); | 104 static DisplayInfoProvider* Create(); |
| 98 | 105 |
| 99 // Update the content of the |unit| obtained for |display| using | 106 // Update the content of the |unit| obtained for |display| using |
| 100 // platform specific method. | 107 // platform specific method. |
| 101 virtual void UpdateDisplayUnitInfoForPlatform( | 108 virtual void UpdateDisplayUnitInfoForPlatform( |
| 102 const display::Display& display, | 109 const display::Display& display, |
| 103 api::system_display::DisplayUnitInfo* unit) = 0; | 110 api::system_display::DisplayUnitInfo* unit) = 0; |
| 104 | 111 |
| 105 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); | 112 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); |
| 106 }; | 113 }; |
| 107 | 114 |
| 108 } // namespace extensions | 115 } // namespace extensions |
| 109 | 116 |
| 110 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ | 117 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ |
| OLD | NEW |