| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/renderer/automation/dom_automation_controller.h" | 5 #include "chrome/renderer/automation/dom_automation_controller.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "content/common/json_value_serializer.h" | 8 #include "content/common/json_value_serializer.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return; | 71 return; |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 | 74 |
| 75 if (!serializer.Serialize(*value)) { | 75 if (!serializer.Serialize(*value)) { |
| 76 result->SetNull(); | 76 result->SetNull(); |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool succeeded = sender_->Send( | 80 bool succeeded = sender_->Send( |
| 81 new ViewHostMsg_DomOperationResponse(routing_id_, json, automation_id_)); | 81 new ChromeViewHostMsg_DomOperationResponse(routing_id_, |
| 82 json, |
| 83 automation_id_)); |
| 82 result->Set(succeeded); | 84 result->Set(succeeded); |
| 83 | 85 |
| 84 automation_id_ = MSG_ROUTING_NONE; | 86 automation_id_ = MSG_ROUTING_NONE; |
| 85 | 87 |
| 86 } | 88 } |
| 87 | 89 |
| 88 void DomAutomationController::SendJSON(const CppArgumentList& args, | 90 void DomAutomationController::SendJSON(const CppArgumentList& args, |
| 89 CppVariant* result) { | 91 CppVariant* result) { |
| 90 if (args.size() != 1) { | 92 if (args.size() != 1) { |
| 91 result->SetNull(); | 93 result->SetNull(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 return; | 105 return; |
| 104 } | 106 } |
| 105 | 107 |
| 106 if (args[0].type != NPVariantType_String) { | 108 if (args[0].type != NPVariantType_String) { |
| 107 result->SetNull(); | 109 result->SetNull(); |
| 108 return; | 110 return; |
| 109 } | 111 } |
| 110 | 112 |
| 111 std::string json = args[0].ToString(); | 113 std::string json = args[0].ToString(); |
| 112 result->Set(sender_->Send( | 114 result->Set(sender_->Send( |
| 113 new ViewHostMsg_DomOperationResponse(routing_id_, json, automation_id_))); | 115 new ChromeViewHostMsg_DomOperationResponse(routing_id_, |
| 116 json, |
| 117 automation_id_))); |
| 114 | 118 |
| 115 automation_id_ = MSG_ROUTING_NONE; | 119 automation_id_ = MSG_ROUTING_NONE; |
| 116 } | 120 } |
| 117 | 121 |
| 118 void DomAutomationController::SetAutomationId( | 122 void DomAutomationController::SetAutomationId( |
| 119 const CppArgumentList& args, CppVariant* result) { | 123 const CppArgumentList& args, CppVariant* result) { |
| 120 if (args.size() != 1) { | 124 if (args.size() != 1) { |
| 121 result->SetNull(); | 125 result->SetNull(); |
| 122 return; | 126 return; |
| 123 } | 127 } |
| 124 | 128 |
| 125 // The check here is for NumberType and not Int32 as | 129 // The check here is for NumberType and not Int32 as |
| 126 // KJS::JSType only defines a NumberType (no Int32) | 130 // KJS::JSType only defines a NumberType (no Int32) |
| 127 if (!args[0].isNumber()) { | 131 if (!args[0].isNumber()) { |
| 128 result->SetNull(); | 132 result->SetNull(); |
| 129 return; | 133 return; |
| 130 } | 134 } |
| 131 | 135 |
| 132 automation_id_ = args[0].ToInt32(); | 136 automation_id_ = args[0].ToInt32(); |
| 133 result->Set(true); | 137 result->Set(true); |
| 134 } | 138 } |
| OLD | NEW |