/chrome/browser/extensions/api/autotest_private/autotest_private_api.h
https://gitlab.com/jonnialva90/iridium-browser · C Header · 197 lines · 148 code · 42 blank · 7 comment · 0 complexity · 0794690df1dd5ae723b9bcc6254063ef MD5 · raw file
- // Copyright (c) 2012 The Chromium Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style license that can be
- // found in the LICENSE file.
- #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_
- #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_
- #include <string>
- #include "base/compiler_specific.h"
- #include "chrome/browser/extensions/chrome_extension_function.h"
- #include "extensions/browser/browser_context_keyed_api_factory.h"
- namespace extensions {
- class AutotestPrivateLogoutFunction : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT)
- private:
- ~AutotestPrivateLogoutFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateRestartFunction : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.restart", AUTOTESTPRIVATE_RESTART)
- private:
- ~AutotestPrivateRestartFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateShutdownFunction : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.shutdown",
- AUTOTESTPRIVATE_SHUTDOWN)
- private:
- ~AutotestPrivateShutdownFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateLoginStatusFunction : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.loginStatus",
- AUTOTESTPRIVATE_LOGINSTATUS)
- private:
- ~AutotestPrivateLoginStatusFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateLockScreenFunction : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.lockScreen",
- AUTOTESTPRIVATE_LOCKSCREEN)
- private:
- ~AutotestPrivateLockScreenFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateGetExtensionsInfoFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.getExtensionsInfo",
- AUTOTESTPRIVATE_GETEXTENSIONSINFO)
- private:
- ~AutotestPrivateGetExtensionsInfoFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSimulateAsanMemoryBugFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.simulateAsanMemoryBug",
- AUTOTESTPRIVATE_SIMULATEASANMEMORYBUG)
- private:
- ~AutotestPrivateSimulateAsanMemoryBugFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetTouchpadSensitivityFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTouchpadSensitivity",
- AUTOTESTPRIVATE_SETTOUCHPADSENSITIVITY)
- private:
- ~AutotestPrivateSetTouchpadSensitivityFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetTapToClickFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTapToClick",
- AUTOTESTPRIVATE_SETTAPTOCLICK)
- private:
- ~AutotestPrivateSetTapToClickFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetThreeFingerClickFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setThreeFingerClick",
- AUTOTESTPRIVATE_SETTHREEFINGERCLICK)
- private:
- ~AutotestPrivateSetThreeFingerClickFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetTapDraggingFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setTapDragging",
- AUTOTESTPRIVATE_SETTAPDRAGGING)
- private:
- ~AutotestPrivateSetTapDraggingFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetNaturalScrollFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setNaturalScroll",
- AUTOTESTPRIVATE_SETNATURALSCROLL)
- private:
- ~AutotestPrivateSetNaturalScrollFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetMouseSensitivityFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setMouseSensitivity",
- AUTOTESTPRIVATE_SETMOUSESENSITIVITY)
- private:
- ~AutotestPrivateSetMouseSensitivityFunction() override {}
- bool RunSync() override;
- };
- class AutotestPrivateSetPrimaryButtonRightFunction
- : public ChromeSyncExtensionFunction {
- public:
- DECLARE_EXTENSION_FUNCTION("autotestPrivate.setPrimaryButtonRight",
- AUTOTESTPRIVATE_SETPRIMARYBUTTONRIGHT)
- private:
- ~AutotestPrivateSetPrimaryButtonRightFunction() override {}
- bool RunSync() override;
- };
- // Don't kill the browser when we're in a browser test.
- void SetAutotestPrivateTest();
- // The profile-keyed service that manages the autotestPrivate extension API.
- class AutotestPrivateAPI : public BrowserContextKeyedAPI {
- public:
- static BrowserContextKeyedAPIFactory<AutotestPrivateAPI>*
- GetFactoryInstance();
- // TODO(achuith): Replace these with a mock object for system calls.
- bool test_mode() const { return test_mode_; }
- void set_test_mode(bool test_mode) { test_mode_ = test_mode; }
- private:
- friend class BrowserContextKeyedAPIFactory<AutotestPrivateAPI>;
- AutotestPrivateAPI();
- ~AutotestPrivateAPI() override;
- // BrowserContextKeyedAPI implementation.
- static const char* service_name() { return "AutotestPrivateAPI"; }
- static const bool kServiceIsNULLWhileTesting = true;
- static const bool kServiceRedirectedInIncognito = true;
- bool test_mode_; // true for ExtensionApiTest.AutotestPrivate browser test.
- };
- template <>
- KeyedService*
- BrowserContextKeyedAPIFactory<AutotestPrivateAPI>::BuildServiceInstanceFor(
- content::BrowserContext* context) const;
- } // namespace extensions
- #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_