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