1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "chrome/browser/extensions/chrome_extension_function.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/public/browser/web_contents_observer.h"
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "content/public/browser/web_contents_user_data.h"
11a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
12a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace content {
13a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)struct AXEventNotificationDetails;
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace content
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace extensions {
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class AutomationActionAdapter;
18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace api {
20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace automation_internal {
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace PerformAction {
22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)struct Params;
23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace PerformAction
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace automation_internal
25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace api
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // namespace extensions
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace ui {
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)struct AXNodeData;
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace extensions {
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Implementation of the chrome.automation API.
3546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)class AutomationInternalEnableTabFunction
36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    : public ChromeUIThreadExtensionFunction {
3746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  DECLARE_EXTENSION_FUNCTION("automationInternal.enableTab",
3846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                             AUTOMATIONINTERNAL_ENABLETAB)
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) protected:
4046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  virtual ~AutomationInternalEnableTabFunction() {}
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
42cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual ExtensionFunction::ResponseAction Run() OVERRIDE;
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)};
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
45c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass AutomationInternalPerformActionFunction
46cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    : public UIThreadExtensionFunction {
47c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  DECLARE_EXTENSION_FUNCTION("automationInternal.performAction",
48c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                             AUTOMATIONINTERNAL_PERFORMACTION)
49c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch protected:
50c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  virtual ~AutomationInternalPerformActionFunction() {}
51c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual ExtensionFunction::ResponseAction Run() OVERRIDE;
53cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private:
55cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Helper function to route an action to an action adapter.
56cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  ExtensionFunction::ResponseAction RouteActionToAdapter(
57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      api::automation_internal::PerformAction::Params* params,
58cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      AutomationActionAdapter* adapter);
59010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)};
60010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
61010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)class AutomationInternalEnableDesktopFunction
62cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    : public UIThreadExtensionFunction {
63010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  DECLARE_EXTENSION_FUNCTION("automationInternal.enableDesktop",
64010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                             AUTOMATIONINTERNAL_ENABLEDESKTOP)
65010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) protected:
66010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  virtual ~AutomationInternalEnableDesktopFunction() {}
67010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual ResponseAction Run() OVERRIDE;
69c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch};
70c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  // namespace extensions
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#endif  // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_API_H_
74