Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / automation_internal / automation_internal_api.h
blob5761d26cd416839f32981f3772df40fe7cb24d82
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_
8 #include "chrome/browser/extensions/chrome_extension_function.h"
9 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/browser/web_contents_user_data.h"
12 namespace content {
13 struct AXEventNotificationDetails;
14 } // namespace content
16 namespace extensions {
17 class AutomationActionAdapter;
19 namespace api {
20 namespace automation_internal {
21 namespace PerformAction {
22 struct Params;
23 } // namespace PerformAction
24 } // namespace automation_internal
25 } // namespace api
26 } // namespace extensions
28 namespace ui {
29 struct AXNodeData;
32 namespace extensions {
34 // Implementation of the chrome.automation API.
35 class AutomationInternalEnableTabFunction
36 : public ChromeUIThreadExtensionFunction {
37 DECLARE_EXTENSION_FUNCTION("automationInternal.enableTab",
38 AUTOMATIONINTERNAL_ENABLETAB)
39 protected:
40 ~AutomationInternalEnableTabFunction() override {}
42 ExtensionFunction::ResponseAction Run() override;
45 class AutomationInternalPerformActionFunction
46 : public UIThreadExtensionFunction {
47 DECLARE_EXTENSION_FUNCTION("automationInternal.performAction",
48 AUTOMATIONINTERNAL_PERFORMACTION)
49 protected:
50 ~AutomationInternalPerformActionFunction() override {}
52 ExtensionFunction::ResponseAction Run() override;
54 private:
55 // Helper function to route an action to an action adapter.
56 ExtensionFunction::ResponseAction RouteActionToAdapter(
57 api::automation_internal::PerformAction::Params* params,
58 AutomationActionAdapter* adapter);
61 class AutomationInternalEnableFrameFunction : public UIThreadExtensionFunction {
62 DECLARE_EXTENSION_FUNCTION("automationInternal.enableFrame",
63 AUTOMATIONINTERNAL_PERFORMACTION)
64 protected:
65 ~AutomationInternalEnableFrameFunction() override {}
67 ExtensionFunction::ResponseAction Run() override;
70 class AutomationInternalEnableDesktopFunction
71 : public UIThreadExtensionFunction {
72 DECLARE_EXTENSION_FUNCTION("automationInternal.enableDesktop",
73 AUTOMATIONINTERNAL_ENABLEDESKTOP)
74 protected:
75 ~AutomationInternalEnableDesktopFunction() override {}
77 ResponseAction Run() override;
80 class AutomationInternalQuerySelectorFunction
81 : public UIThreadExtensionFunction {
82 DECLARE_EXTENSION_FUNCTION("automationInternal.querySelector",
83 AUTOMATIONINTERNAL_ENABLEDESKTOP)
85 public:
86 typedef base::Callback<void(const std::string& error,
87 int result_acc_obj_id)> Callback;
89 protected:
90 ~AutomationInternalQuerySelectorFunction() override {}
92 ResponseAction Run() override;
94 private:
95 void OnResponse(const std::string& error, int result_acc_obj_id);
97 // Used for assigning a unique ID to each request so that the response can be
98 // routed appropriately.
99 static int query_request_id_counter_;
102 } // namespace extensions
104 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_