| 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/test/automation/tab_proxy.h" | 5 #include "chrome/test/automation/tab_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/common/json_value_serializer.h" | 10 #include "chrome/common/json_value_serializer.h" |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 std::string json; | 334 std::string json; |
| 335 if (!sender_->Send(new AutomationMsg_DomOperation(0, handle_, frame_xpath, | 335 if (!sender_->Send(new AutomationMsg_DomOperation(0, handle_, frame_xpath, |
| 336 jscript, &json))) | 336 jscript, &json))) |
| 337 return false; | 337 return false; |
| 338 // Wrap |json| in an array before deserializing because valid JSON has an | 338 // Wrap |json| in an array before deserializing because valid JSON has an |
| 339 // array or an object as the root. | 339 // array or an object as the root. |
| 340 json.insert(0, "["); | 340 json.insert(0, "["); |
| 341 json.append("]"); | 341 json.append("]"); |
| 342 | 342 |
| 343 JSONStringValueSerializer deserializer(json); | 343 JSONStringValueSerializer deserializer(json); |
| 344 *value = deserializer.Deserialize(NULL); | 344 *value = deserializer.Deserialize(NULL, NULL); |
| 345 return *value != NULL; | 345 return *value != NULL; |
| 346 } | 346 } |
| 347 | 347 |
| 348 bool TabProxy::SetEnableExtensionAutomation( | 348 bool TabProxy::SetEnableExtensionAutomation( |
| 349 const std::vector<std::string>& functions_enabled) { | 349 const std::vector<std::string>& functions_enabled) { |
| 350 if (!is_valid()) | 350 if (!is_valid()) |
| 351 return false; | 351 return false; |
| 352 | 352 |
| 353 return sender_->Send(new AutomationMsg_SetEnableExtensionAutomation( | 353 return sender_->Send(new AutomationMsg_SetEnableExtensionAutomation( |
| 354 0, handle_, functions_enabled)); | 354 0, handle_, functions_enabled)); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 void TabProxy::OnMessageReceived(const IPC::Message& message) { | 746 void TabProxy::OnMessageReceived(const IPC::Message& message) { |
| 747 AutoLock lock(list_lock_); | 747 AutoLock lock(list_lock_); |
| 748 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, | 748 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, |
| 749 OnMessageReceived(this, message)); | 749 OnMessageReceived(this, message)); |
| 750 } | 750 } |
| 751 | 751 |
| 752 void TabProxy::OnChannelError() { | 752 void TabProxy::OnChannelError() { |
| 753 AutoLock lock(list_lock_); | 753 AutoLock lock(list_lock_); |
| 754 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); | 754 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnChannelError(this)); |
| 755 } | 755 } |
| OLD | NEW |