| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_AP
I_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_AP
I_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_AP
I_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL_AP
I_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/chrome_extension_function.h" | 8 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 class AutomationActionAdapter; | |
| 14 | 13 |
| 15 namespace api { | 14 namespace api { |
| 16 namespace automation_internal { | 15 namespace automation_internal { |
| 17 namespace PerformAction { | 16 namespace PerformAction { |
| 18 struct Params; | 17 struct Params; |
| 19 } // namespace PerformAction | 18 } // namespace PerformAction |
| 20 } // namespace automation_internal | 19 } // namespace automation_internal |
| 21 } // namespace api | 20 } // namespace api |
| 22 } // namespace extensions | 21 } // namespace extensions |
| 23 | 22 |
| 23 namespace ui { |
| 24 struct AXActionData; |
| 25 } // namespace ui |
| 26 |
| 24 namespace extensions { | 27 namespace extensions { |
| 25 | 28 |
| 26 // Implementation of the chrome.automation API. | 29 // Implementation of the chrome.automation API. |
| 27 class AutomationInternalEnableTabFunction | 30 class AutomationInternalEnableTabFunction |
| 28 : public ChromeUIThreadExtensionFunction { | 31 : public ChromeUIThreadExtensionFunction { |
| 29 DECLARE_EXTENSION_FUNCTION("automationInternal.enableTab", | 32 DECLARE_EXTENSION_FUNCTION("automationInternal.enableTab", |
| 30 AUTOMATIONINTERNAL_ENABLETAB) | 33 AUTOMATIONINTERNAL_ENABLETAB) |
| 31 protected: | 34 protected: |
| 32 ~AutomationInternalEnableTabFunction() override {} | 35 ~AutomationInternalEnableTabFunction() override {} |
| 33 | 36 |
| 34 ExtensionFunction::ResponseAction Run() override; | 37 ExtensionFunction::ResponseAction Run() override; |
| 35 }; | 38 }; |
| 36 | 39 |
| 37 class AutomationInternalPerformActionFunction | 40 class AutomationInternalPerformActionFunction |
| 38 : public UIThreadExtensionFunction { | 41 : public UIThreadExtensionFunction { |
| 39 DECLARE_EXTENSION_FUNCTION("automationInternal.performAction", | 42 DECLARE_EXTENSION_FUNCTION("automationInternal.performAction", |
| 40 AUTOMATIONINTERNAL_PERFORMACTION) | 43 AUTOMATIONINTERNAL_PERFORMACTION) |
| 41 protected: | 44 protected: |
| 42 ~AutomationInternalPerformActionFunction() override {} | 45 ~AutomationInternalPerformActionFunction() override {} |
| 43 | 46 |
| 44 ExtensionFunction::ResponseAction Run() override; | 47 ExtensionFunction::ResponseAction Run() override; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 // Helper function to route an action to an action adapter. | 50 // Helper function to convert extension action to ax action. |
| 48 ExtensionFunction::ResponseAction RouteActionToAdapter( | 51 ExtensionFunction::ResponseAction ConvertToAXActionData( |
| 49 api::automation_internal::PerformAction::Params* params, | 52 api::automation_internal::PerformAction::Params* params, |
| 50 AutomationActionAdapter* adapter); | 53 ui::AXActionData* data); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 class AutomationInternalEnableFrameFunction : public UIThreadExtensionFunction { | 56 class AutomationInternalEnableFrameFunction : public UIThreadExtensionFunction { |
| 54 DECLARE_EXTENSION_FUNCTION("automationInternal.enableFrame", | 57 DECLARE_EXTENSION_FUNCTION("automationInternal.enableFrame", |
| 55 AUTOMATIONINTERNAL_PERFORMACTION) | 58 AUTOMATIONINTERNAL_PERFORMACTION) |
| 56 protected: | 59 protected: |
| 57 ~AutomationInternalEnableFrameFunction() override {} | 60 ~AutomationInternalEnableFrameFunction() override {} |
| 58 | 61 |
| 59 ExtensionFunction::ResponseAction Run() override; | 62 ExtensionFunction::ResponseAction Run() override; |
| 60 }; | 63 }; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 87 void OnResponse(const std::string& error, int result_acc_obj_id); | 90 void OnResponse(const std::string& error, int result_acc_obj_id); |
| 88 | 91 |
| 89 // Used for assigning a unique ID to each request so that the response can be | 92 // Used for assigning a unique ID to each request so that the response can be |
| 90 // routed appropriately. | 93 // routed appropriately. |
| 91 static int query_request_id_counter_; | 94 static int query_request_id_counter_; |
| 92 }; | 95 }; |
| 93 | 96 |
| 94 } // namespace extensions | 97 } // namespace extensions |
| 95 | 98 |
| 96 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL
_API_H_ | 99 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_INTERNAL
_API_H_ |
| OLD | NEW |