OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ValueConversions_h | 5 #ifndef ValueConversions_h |
6 #define ValueConversions_h | 6 #define ValueConversions_h |
7 | 7 |
8 #include "platform/inspector_protocol/ErrorSupport.h" | 8 #include "platform/inspector_protocol/ErrorSupport.h" |
9 #include "platform/inspector_protocol/Platform.h" | 9 #include "platform/inspector_protocol/Platform.h" |
10 #include "platform/inspector_protocol/String16.h" | 10 #include "platform/inspector_protocol/String16.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return result; | 76 return result; |
77 } | 77 } |
78 | 78 |
79 static std::unique_ptr<protocol::Value> serialize(double value) | 79 static std::unique_ptr<protocol::Value> serialize(double value) |
80 { | 80 { |
81 return FundamentalValue::create(value); | 81 return FundamentalValue::create(value); |
82 } | 82 } |
83 }; | 83 }; |
84 | 84 |
85 template<> | 85 template<> |
86 struct ValueConversions<String> { | 86 struct ValueConversions<InspectorProtocolConvenienceStringType> { |
87 static String parse(protocol::Value* value, ErrorSupport* errors) | 87 static InspectorProtocolConvenienceStringType parse(protocol::Value* value,
ErrorSupport* errors) |
88 { | 88 { |
89 String16 result; | 89 String16 result; |
90 bool success = value ? value->asString(&result) : false; | 90 bool success = value ? value->asString(&result) : false; |
91 if (!success) | 91 if (!success) |
92 errors->addError("string value expected"); | 92 errors->addError("string value expected"); |
93 return result; | 93 return result; |
94 } | 94 } |
95 | 95 |
96 static std::unique_ptr<protocol::Value> serialize(const String& value) | 96 static std::unique_ptr<protocol::Value> serialize(const InspectorProtocolCon
venienceStringType& value) |
97 { | 97 { |
98 return StringValue::create(value); | 98 return StringValue::create(value); |
99 } | 99 } |
100 }; | 100 }; |
101 | 101 |
102 template<> | 102 template<> |
103 struct ValueConversions<String16> { | 103 struct ValueConversions<String16> { |
104 static String16 parse(protocol::Value* value, ErrorSupport* errors) | 104 static String16 parse(protocol::Value* value, ErrorSupport* errors) |
105 { | 105 { |
106 String16 result; | 106 String16 result; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<List
Value>& value) | 178 static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<List
Value>& value) |
179 { | 179 { |
180 return value->clone(); | 180 return value->clone(); |
181 } | 181 } |
182 }; | 182 }; |
183 | 183 |
184 } // namespace platform | 184 } // namespace platform |
185 } // namespace blink | 185 } // namespace blink |
186 | 186 |
187 #endif // !defined(ValueConversions_h) | 187 #endif // !defined(ValueConversions_h) |
OLD | NEW |