Chromium Code Reviews| 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(); | |
|
lazyboy
2016/08/26 23:13:16
Not obvious to me where webui comes to play, can y
Devlin
2016/08/29 16:05:57
I've changed the implementation to be clearer. Us
| |
| 22 }; | 26 }; |
| 23 | 27 |
| 24 class SystemDisplayGetInfoFunction : public SystemDisplayFunction { | 28 class SystemDisplayGetInfoFunction : public SystemDisplayFunction { |
| 25 public: | 29 public: |
| 26 DECLARE_EXTENSION_FUNCTION("system.display.getInfo", SYSTEM_DISPLAY_GETINFO); | 30 DECLARE_EXTENSION_FUNCTION("system.display.getInfo", SYSTEM_DISPLAY_GETINFO); |
| 27 | 31 |
| 28 protected: | 32 protected: |
| 29 ~SystemDisplayGetInfoFunction() override {} | 33 ~SystemDisplayGetInfoFunction() override {} |
| 30 bool RunSync() override; | 34 ResponseAction Run() override; |
| 35 bool ShouldRestrictToKioskAndWebUI() override; | |
| 31 }; | 36 }; |
| 32 | 37 |
| 33 class SystemDisplayGetDisplayLayoutFunction : public SystemDisplayFunction { | 38 class SystemDisplayGetDisplayLayoutFunction : public SystemDisplayFunction { |
| 34 public: | 39 public: |
| 35 DECLARE_EXTENSION_FUNCTION("system.display.getDisplayLayout", | 40 DECLARE_EXTENSION_FUNCTION("system.display.getDisplayLayout", |
| 36 SYSTEM_DISPLAY_GETDISPLAYLAYOUT); | 41 SYSTEM_DISPLAY_GETDISPLAYLAYOUT); |
| 37 | 42 |
| 38 protected: | 43 protected: |
| 39 ~SystemDisplayGetDisplayLayoutFunction() override {} | 44 ~SystemDisplayGetDisplayLayoutFunction() override {} |
| 40 bool RunSync() override; | 45 ResponseAction Run() override; |
| 46 bool ShouldRestrictToKioskAndWebUI() override; | |
| 41 }; | 47 }; |
| 42 | 48 |
| 43 class SystemDisplaySetDisplayPropertiesFunction : public SystemDisplayFunction { | 49 class SystemDisplaySetDisplayPropertiesFunction : public SystemDisplayFunction { |
| 44 public: | 50 public: |
| 45 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayProperties", | 51 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayProperties", |
| 46 SYSTEM_DISPLAY_SETDISPLAYPROPERTIES); | 52 SYSTEM_DISPLAY_SETDISPLAYPROPERTIES); |
| 47 | 53 |
| 48 protected: | 54 protected: |
| 49 ~SystemDisplaySetDisplayPropertiesFunction() override {} | 55 ~SystemDisplaySetDisplayPropertiesFunction() override {} |
| 50 bool RunSync() override; | 56 ResponseAction Run() override; |
| 51 }; | 57 }; |
| 52 | 58 |
| 53 class SystemDisplaySetDisplayLayoutFunction : public SystemDisplayFunction { | 59 class SystemDisplaySetDisplayLayoutFunction : public SystemDisplayFunction { |
| 54 public: | 60 public: |
| 55 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayLayout", | 61 DECLARE_EXTENSION_FUNCTION("system.display.setDisplayLayout", |
| 56 SYSTEM_DISPLAY_SETDISPLAYLAYOUT); | 62 SYSTEM_DISPLAY_SETDISPLAYLAYOUT); |
| 57 | 63 |
| 58 protected: | 64 protected: |
| 59 ~SystemDisplaySetDisplayLayoutFunction() override {} | 65 ~SystemDisplaySetDisplayLayoutFunction() override {} |
| 60 bool RunSync() override; | 66 ResponseAction Run() override; |
| 61 }; | 67 }; |
| 62 | 68 |
| 63 class SystemDisplayEnableUnifiedDesktopFunction : public SystemDisplayFunction { | 69 class SystemDisplayEnableUnifiedDesktopFunction : public SystemDisplayFunction { |
| 64 public: | 70 public: |
| 65 DECLARE_EXTENSION_FUNCTION("system.display.enableUnifiedDesktop", | 71 DECLARE_EXTENSION_FUNCTION("system.display.enableUnifiedDesktop", |
| 66 SYSTEM_DISPLAY_ENABLEUNIFIEDDESKTOP); | 72 SYSTEM_DISPLAY_ENABLEUNIFIEDDESKTOP); |
| 67 | 73 |
| 68 protected: | 74 protected: |
| 69 ~SystemDisplayEnableUnifiedDesktopFunction() override {} | 75 ~SystemDisplayEnableUnifiedDesktopFunction() override {} |
| 70 bool RunSync() override; | 76 ResponseAction Run() override; |
| 71 }; | 77 }; |
| 72 | 78 |
| 73 class SystemDisplayOverscanCalibrationStartFunction | 79 class SystemDisplayOverscanCalibrationStartFunction |
| 74 : public SystemDisplayFunction { | 80 : public SystemDisplayFunction { |
| 75 public: | 81 public: |
| 76 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationStart", | 82 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationStart", |
| 77 SYSTEM_DISPLAY_OVERSCANCALIBRATIONSTART); | 83 SYSTEM_DISPLAY_OVERSCANCALIBRATIONSTART); |
| 78 | 84 |
| 79 protected: | 85 protected: |
| 80 ~SystemDisplayOverscanCalibrationStartFunction() override {} | 86 ~SystemDisplayOverscanCalibrationStartFunction() override {} |
| 81 bool RunSync() override; | 87 ResponseAction Run() override; |
| 82 }; | 88 }; |
| 83 | 89 |
| 84 class SystemDisplayOverscanCalibrationAdjustFunction | 90 class SystemDisplayOverscanCalibrationAdjustFunction |
| 85 : public SystemDisplayFunction { | 91 : public SystemDisplayFunction { |
| 86 public: | 92 public: |
| 87 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationAdjust", | 93 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationAdjust", |
| 88 SYSTEM_DISPLAY_OVERSCANCALIBRATIONADJUST); | 94 SYSTEM_DISPLAY_OVERSCANCALIBRATIONADJUST); |
| 89 | 95 |
| 90 protected: | 96 protected: |
| 91 ~SystemDisplayOverscanCalibrationAdjustFunction() override {} | 97 ~SystemDisplayOverscanCalibrationAdjustFunction() override {} |
| 92 bool RunSync() override; | 98 ResponseAction Run() override; |
| 93 }; | 99 }; |
| 94 | 100 |
| 95 class SystemDisplayOverscanCalibrationResetFunction | 101 class SystemDisplayOverscanCalibrationResetFunction |
| 96 : public SystemDisplayFunction { | 102 : public SystemDisplayFunction { |
| 97 public: | 103 public: |
| 98 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationReset", | 104 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationReset", |
| 99 SYSTEM_DISPLAY_OVERSCANCALIBRATIONRESET); | 105 SYSTEM_DISPLAY_OVERSCANCALIBRATIONRESET); |
| 100 | 106 |
| 101 protected: | 107 protected: |
| 102 ~SystemDisplayOverscanCalibrationResetFunction() override {} | 108 ~SystemDisplayOverscanCalibrationResetFunction() override {} |
| 103 bool RunSync() override; | 109 ResponseAction Run() override; |
| 104 }; | 110 }; |
| 105 | 111 |
| 106 class SystemDisplayOverscanCalibrationCompleteFunction | 112 class SystemDisplayOverscanCalibrationCompleteFunction |
| 107 : public SystemDisplayFunction { | 113 : public SystemDisplayFunction { |
| 108 public: | 114 public: |
| 109 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationComplete", | 115 DECLARE_EXTENSION_FUNCTION("system.display.overscanCalibrationComplete", |
| 110 SYSTEM_DISPLAY_OVERSCANCALIBRATIONCOMPLETE); | 116 SYSTEM_DISPLAY_OVERSCANCALIBRATIONCOMPLETE); |
| 111 | 117 |
| 112 protected: | 118 protected: |
| 113 ~SystemDisplayOverscanCalibrationCompleteFunction() override {} | 119 ~SystemDisplayOverscanCalibrationCompleteFunction() override {} |
| 114 bool RunSync() override; | 120 ResponseAction Run() override; |
| 115 }; | 121 }; |
| 116 | 122 |
| 117 } // namespace extensions | 123 } // namespace extensions |
| 118 | 124 |
| 119 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ | 125 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_SYSTEM_DISPLAY_API_H_ |
| OLD | NEW |