| 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_SYSTEM_DISPLAY_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ | 6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 class SystemDisplayFunction : public SyncExtensionFunction { | 14 class SystemDisplayFunction : public UIThreadExtensionFunction { |
| 15 public: | 15 public: |
| 16 static const char kCrosOnlyError[]; | 16 static const char kCrosOnlyError[]; |
| 17 static const char kKioskOnlyError[]; | 17 static const char kKioskOnlyError[]; |
| 18 | 18 |
| 19 protected: | 19 protected: |
| 20 ~SystemDisplayFunction() override {} | 20 ~SystemDisplayFunction() override {} |
| 21 bool CheckValidExtension(); | 21 bool PreRunValidation(std::string* error) override; |
| 22 |
| 23 // Returns true if this function should be restricted to kiosk-mode apps and |
| 24 // webui. The default is true. |
| 25 virtual bool ShouldRestrictToKioskAndWebUI(); |
| 22 }; | 26 }; |
| 23 | 27 |
| 24 class SystemDisplayGetInfoFunction : public SystemDisplayFunction { | 28 // This function inherits from UIThreadExtensionFunction because, unlike the |
| 29 // rest of this API, it's available on all platforms. |
| 30 class SystemDisplayGetInfoFunction : public UIThreadExtensionFunction { |
| 25 public: | 31 public: |
| 26 DECLARE_EXTENSION_FUNCTION("system.display.getInfo", SYSTEM_DISPLAY_GETINFO); | 32 DECLARE_EXTENSION_FUNCTION("system.display.getInfo", SYSTEM_DISPLAY_GETINFO); |
| 27 | 33 |
| 28 protected: | 34 protected: |
| 29 ~SystemDisplayGetInfoFunction() override {} | 35 ~SystemDisplayGetInfoFunction() override {} |
| 30 bool RunSync() override; | 36 ResponseAction Run() override; |
| 31 }; | 37 }; |
| 32 | 38 |
| 33 class SystemDisplayGetDisplayLayoutFunction : public SystemDisplayFunction { | 39 class SystemDisplayGetDisplayLayoutFunction : public SystemDisplayFunction { |
| 34 public: | 40 public: |
| 35 DECLARE_EXTENSION_FUNCTION("system.display.getDisplayLayout", | 41 DECLARE_EXTENSION_FUNCTION("system.display.getDisplayLayout", |
| 36 SYSTEM_DISPLAY_GETDISPLAYLAYOUT); | 42 SYSTEM_DISPLAY_GETDISPLAYLAYOUT); |
| 37 | 43 |
| 38 protected: | 44 protected: |
| 39 ~SystemDisplayGetDisplayLayoutFunction() override {} | 45 ~SystemDisplayGetDisplayLayoutFunction() override {} |
| 40 bool RunSync() override; | 46 ResponseAction Run() override; |
| 47 bool ShouldRestrictToKioskAndWebUI() override; |
| 41 }; | 48 }; |
| 42 | 49 |
| 43 class SystemDisplaySetDisplayPropertiesFunction : public SystemDisplayFunction { | 50 class SystemDisplaySetDisplayPropertiesFunction : public SystemDisplayFunction { |
| 44 public: | 51 public: |
| 45 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayProperties", | 52 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayProperties", |
| 46 SYSTEM_DISPLAY_SETDISPLAYPROPERTIES); | 53 SYSTEM_DISPLAY_SETDISPLAYPROPERTIES); |
| 47 | 54 |
| 48 protected: | 55 protected: |
| 49 ~SystemDisplaySetDisplayPropertiesFunction() override {} | 56 ~SystemDisplaySetDisplayPropertiesFunction() override {} |
| 50 bool RunSync() override; | 57 ResponseAction Run() override; |
| 51 }; | 58 }; |
| 52 | 59 |
| 53 class SystemDisplaySetDisplayLayoutFunction : public SystemDisplayFunction { | 60 class SystemDisplaySetDisplayLayoutFunction : public SystemDisplayFunction { |
| 54 public: | 61 public: |
| 55 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayLayout", | 62 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayLayout", |
| 56 SYSTEM_DISPLAY_SETDISPLAYLAYOUT); | 63 SYSTEM_DISPLAY_SETDISPLAYLAYOUT); |
| 57 | 64 |
| 58 protected: | 65 protected: |
| 59 ~SystemDisplaySetDisplayLayoutFunction() override {} | 66 ~SystemDisplaySetDisplayLayoutFunction() override {} |
| 60 bool RunSync() override; | 67 ResponseAction Run() override; |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 class SystemDisplayEnableUnifiedDesktopFunction : public SystemDisplayFunction { | 70 class SystemDisplayEnableUnifiedDesktopFunction : public SystemDisplayFunction { |
| 64 public: | 71 public: |
| 65 DECLARE_EXTENSION_FUNCTION("system.display.enableUnifiedDesktop", | 72 DECLARE_EXTENSION_FUNCTION("system.display.enableUnifiedDesktop", |
| 66 SYSTEM_DISPLAY_ENABLEUNIFIEDDESKTOP); | 73 SYSTEM_DISPLAY_ENABLEUNIFIEDDESKTOP); |
| 67 | 74 |
| 68 protected: | 75 protected: |
| 69 ~SystemDisplayEnableUnifiedDesktopFunction() override {} | 76 ~SystemDisplayEnableUnifiedDesktopFunction() override {} |
| 70 bool RunSync() override; | 77 ResponseAction Run() override; |
| 71 }; | 78 }; |
| 72 | 79 |
| 73 class SystemDisplayOverscanCalibrationStartFunction | 80 class SystemDisplayOverscanCalibrationStartFunction |
| 74 : public SystemDisplayFunction { | 81 : public SystemDisplayFunction { |
| 75 public: | 82 public: |
| 76 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationStart", | 83 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationStart", |
| 77 SYSTEM_DISPLAY_OVERSCANCALIBRATIONSTART); | 84 SYSTEM_DISPLAY_OVERSCANCALIBRATIONSTART); |
| 78 | 85 |
| 79 protected: | 86 protected: |
| 80 ~SystemDisplayOverscanCalibrationStartFunction() override {} | 87 ~SystemDisplayOverscanCalibrationStartFunction() override {} |
| 81 bool RunSync() override; | 88 ResponseAction Run() override; |
| 82 }; | 89 }; |
| 83 | 90 |
| 84 class SystemDisplayOverscanCalibrationAdjustFunction | 91 class SystemDisplayOverscanCalibrationAdjustFunction |
| 85 : public SystemDisplayFunction { | 92 : public SystemDisplayFunction { |
| 86 public: | 93 public: |
| 87 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationAdjust", | 94 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationAdjust", |
| 88 SYSTEM_DISPLAY_OVERSCANCALIBRATIONADJUST); | 95 SYSTEM_DISPLAY_OVERSCANCALIBRATIONADJUST); |
| 89 | 96 |
| 90 protected: | 97 protected: |
| 91 ~SystemDisplayOverscanCalibrationAdjustFunction() override {} | 98 ~SystemDisplayOverscanCalibrationAdjustFunction() override {} |
| 92 bool RunSync() override; | 99 ResponseAction Run() override; |
| 93 }; | 100 }; |
| 94 | 101 |
| 95 class SystemDisplayOverscanCalibrationResetFunction | 102 class SystemDisplayOverscanCalibrationResetFunction |
| 96 : public SystemDisplayFunction { | 103 : public SystemDisplayFunction { |
| 97 public: | 104 public: |
| 98 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationReset", | 105 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationReset", |
| 99 SYSTEM_DISPLAY_OVERSCANCALIBRATIONRESET); | 106 SYSTEM_DISPLAY_OVERSCANCALIBRATIONRESET); |
| 100 | 107 |
| 101 protected: | 108 protected: |
| 102 ~SystemDisplayOverscanCalibrationResetFunction() override {} | 109 ~SystemDisplayOverscanCalibrationResetFunction() override {} |
| 103 bool RunSync() override; | 110 ResponseAction Run() override; |
| 104 }; | 111 }; |
| 105 | 112 |
| 106 class SystemDisplayOverscanCalibrationCompleteFunction | 113 class SystemDisplayOverscanCalibrationCompleteFunction |
| 107 : public SystemDisplayFunction { | 114 : public SystemDisplayFunction { |
| 108 public: | 115 public: |
| 109 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationComplete", | 116 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationComplete", |
| 110 SYSTEM_DISPLAY_OVERSCANCALIBRATIONCOMPLETE); | 117 SYSTEM_DISPLAY_OVERSCANCALIBRATIONCOMPLETE); |
| 111 | 118 |
| 112 protected: | 119 protected: |
| 113 ~SystemDisplayOverscanCalibrationCompleteFunction() override {} | 120 ~SystemDisplayOverscanCalibrationCompleteFunction() override {} |
| 114 bool RunSync() override; | 121 ResponseAction Run() override; |
| 115 }; | 122 }; |
| 116 | 123 |
| 117 } // namespace extensions | 124 } // namespace extensions |
| 118 | 125 |
| 119 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ | 126 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ |
| OLD | NEW |