| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // TODO(pfeldman): Remove these once JSON is available in | 5 // TODO(pfeldman): Remove these once JSON is available in |
| 6 // WebCore namespace. | 6 // WebCore namespace. |
| 7 | 7 |
| 8 #include "PlatformString.h" | 8 #include "PlatformString.h" |
| 9 #undef LOG | 9 #undef LOG |
| 10 | 10 |
| 11 #include "base/json_reader.h" | 11 #include "base/json_reader.h" |
| 12 #include "base/json_writer.h" | 12 #include "base/json_writer.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "webkit/glue/devtools/devtools_rpc.h" | 14 #include "webkit/glue/devtools/devtools_rpc.h" |
| 15 #include "webkit/glue/glue_util.h" | 15 #include "webkit/glue/glue_util.h" |
| 16 | 16 |
| 17 DevToolsRpc::DevToolsRpc(Delegate* delegate) : delegate_(delegate) { | 17 DevToolsRpc::DevToolsRpc(Delegate* delegate) : delegate_(delegate) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 DevToolsRpc::~DevToolsRpc() { | 20 DevToolsRpc::~DevToolsRpc() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void DevToolsRpc::SendValueMessage(const Value& value) { | 23 void DevToolsRpc::SendValueMessage(const std::string& class_name, |
| 24 delegate_->SendRpcMessage(Serialize(value)); | 24 const std::string& method_name, |
| 25 const Value& value) { |
| 26 delegate_->SendRpcMessage(class_name, method_name, Serialize(value)); |
| 25 } | 27 } |
| 26 | 28 |
| 27 // static | 29 // static |
| 28 Value* DevToolsRpc::ParseMessage(const std::string& raw_msg) { | 30 Value* DevToolsRpc::ParseMessage(const std::string& raw_msg) { |
| 29 return JSONReader::Read(raw_msg, false); | 31 return JSONReader::Read(raw_msg, false); |
| 30 } | 32 } |
| 31 | 33 |
| 32 // static | 34 // static |
| 33 std::string DevToolsRpc::Serialize(const Value& value) { | 35 std::string DevToolsRpc::Serialize(const Value& value) { |
| 34 std::string json; | 36 std::string json; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 100 |
| 99 // static | 101 // static |
| 100 Value* DevToolsRpc::CreateValue(bool* value) { | 102 Value* DevToolsRpc::CreateValue(bool* value) { |
| 101 return Value::CreateBooleanValue(*value); | 103 return Value::CreateBooleanValue(*value); |
| 102 } | 104 } |
| 103 | 105 |
| 104 // static | 106 // static |
| 105 Value* DevToolsRpc::CreateValue(const Value* value) { | 107 Value* DevToolsRpc::CreateValue(const Value* value) { |
| 106 return value->DeepCopy(); | 108 return value->DeepCopy(); |
| 107 } | 109 } |
| OLD | NEW |