| 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 #include "extensions/renderer/api/automation/automation_api_helper.h" | 5 #include "extensions/renderer/api/automation/automation_api_helper.h" |
| 6 | 6 |
| 7 #include "content/public/renderer/render_view.h" | 7 #include "content/public/renderer/render_view.h" |
| 8 #include "extensions/common/extension_messages.h" | 8 #include "extensions/common/extension_messages.h" |
| 9 #include "third_party/WebKit/public/web/WebAXObject.h" | 9 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 10 #include "third_party/WebKit/public/web/WebDocument.h" | 10 #include "third_party/WebKit/public/web/WebDocument.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 bool AutomationApiHelper::OnMessageReceived(const IPC::Message& message) { | 26 bool AutomationApiHelper::OnMessageReceived(const IPC::Message& message) { |
| 27 bool handled = true; | 27 bool handled = true; |
| 28 IPC_BEGIN_MESSAGE_MAP(AutomationApiHelper, message) | 28 IPC_BEGIN_MESSAGE_MAP(AutomationApiHelper, message) |
| 29 IPC_MESSAGE_HANDLER(ExtensionMsg_AutomationQuerySelector, OnQuerySelector) | 29 IPC_MESSAGE_HANDLER(ExtensionMsg_AutomationQuerySelector, OnQuerySelector) |
| 30 IPC_MESSAGE_UNHANDLED(handled = false) | 30 IPC_MESSAGE_UNHANDLED(handled = false) |
| 31 IPC_END_MESSAGE_MAP() | 31 IPC_END_MESSAGE_MAP() |
| 32 return handled; | 32 return handled; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void AutomationApiHelper::OnDestruct() { |
| 36 delete this; |
| 37 } |
| 38 |
| 35 void AutomationApiHelper::OnQuerySelector(int request_id, | 39 void AutomationApiHelper::OnQuerySelector(int request_id, |
| 36 int acc_obj_id, | 40 int acc_obj_id, |
| 37 const base::string16& selector) { | 41 const base::string16& selector) { |
| 38 ExtensionHostMsg_AutomationQuerySelector_Error error; | 42 ExtensionHostMsg_AutomationQuerySelector_Error error; |
| 39 if (!render_view() || !render_view()->GetWebView() || | 43 if (!render_view() || !render_view()->GetWebView() || |
| 40 !render_view()->GetWebView()->mainFrame()) { | 44 !render_view()->GetWebView()->mainFrame()) { |
| 41 error.value = ExtensionHostMsg_AutomationQuerySelector_Error::kNoMainFrame; | 45 error.value = ExtensionHostMsg_AutomationQuerySelector_Error::kNoMainFrame; |
| 42 Send(new ExtensionHostMsg_AutomationQuerySelector_Result( | 46 Send(new ExtensionHostMsg_AutomationQuerySelector_Result( |
| 43 routing_id(), request_id, error, 0)); | 47 routing_id(), request_id, error, 0)); |
| 44 return; | 48 return; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 result_acc_obj = result_acc_obj.parentObject(); | 84 result_acc_obj = result_acc_obj.parentObject(); |
| 81 | 85 |
| 82 result_acc_obj_id = result_acc_obj.axID(); | 86 result_acc_obj_id = result_acc_obj.axID(); |
| 83 } | 87 } |
| 84 } | 88 } |
| 85 Send(new ExtensionHostMsg_AutomationQuerySelector_Result( | 89 Send(new ExtensionHostMsg_AutomationQuerySelector_Result( |
| 86 routing_id(), request_id, error, result_acc_obj_id)); | 90 routing_id(), request_id, error, result_acc_obj_id)); |
| 87 } | 91 } |
| 88 | 92 |
| 89 } // namespace extensions | 93 } // namespace extensions |
| OLD | NEW |