OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/glue/idb_bindings.h" | 5 #include "webkit/glue/idb_bindings.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
15 | 15 |
16 namespace webkit_glue { | 16 namespace webkit_glue { |
17 | 17 |
18 using WebKit::WebIDBKey; | 18 using WebKit::WebIDBKey; |
19 using WebKit::WebIDBKeyPath; | 19 using WebKit::WebIDBKeyPath; |
20 using WebKit::WebSerializedScriptValue; | 20 using WebKit::WebSerializedScriptValue; |
| 21 using WebKit::WebString; |
21 | 22 |
22 bool IDBKeysFromValuesAndKeyPath( | 23 bool IDBKeysFromValuesAndKeyPath( |
23 const std::vector<WebSerializedScriptValue>& serialized_script_values, | 24 const std::vector<WebSerializedScriptValue>& serialized_script_values, |
24 const string16& idb_key_path, | 25 const string16& idb_key_path, |
25 std::vector<WebIDBKey>* values) { | 26 std::vector<WebIDBKey>* values) { |
26 WebIDBKeyPath web_idb_key_path = WebIDBKeyPath::create(idb_key_path); | 27 // TODO(jsbell): Remove the explicit coercion to WebString. |
| 28 // http://crbug.com/112308 |
| 29 WebIDBKeyPath web_idb_key_path = |
| 30 WebIDBKeyPath::create(WebString(idb_key_path)); |
27 bool error = web_idb_key_path.parseError() != 0; | 31 bool error = web_idb_key_path.parseError() != 0; |
28 // When a parse error is encountered, no value is returned (null) | 32 // When a parse error is encountered, no value is returned (null) |
29 for (std::vector<WebSerializedScriptValue>::const_iterator i = | 33 for (std::vector<WebSerializedScriptValue>::const_iterator i = |
30 serialized_script_values.begin(); | 34 serialized_script_values.begin(); |
31 i != serialized_script_values.end(); ++i) { | 35 i != serialized_script_values.end(); ++i) { |
32 if (error) { | 36 if (error) { |
33 values->push_back(WebIDBKey::createNull()); | 37 values->push_back(WebIDBKey::createNull()); |
34 } else { | 38 } else { |
35 values->push_back( | 39 values->push_back( |
36 WebIDBKey::createFromValueAndKeyPath(*i, web_idb_key_path)); | 40 WebIDBKey::createFromValueAndKeyPath(*i, web_idb_key_path)); |
37 } | 41 } |
38 } | 42 } |
39 return error; | 43 return error; |
40 } | 44 } |
41 | 45 |
42 WebSerializedScriptValue InjectIDBKey( | 46 WebSerializedScriptValue InjectIDBKey( |
43 const WebIDBKey& key, | 47 const WebIDBKey& key, |
44 const WebSerializedScriptValue& value, | 48 const WebSerializedScriptValue& value, |
45 const string16& idb_key_path) { | 49 const string16& idb_key_path) { |
| 50 // TODO(jsbell): Remove the explicit coercion to WebString. |
| 51 // http://crbug.com/112308 |
46 return WebIDBKey::injectIDBKeyIntoSerializedValue( | 52 return WebIDBKey::injectIDBKeyIntoSerializedValue( |
47 key, value, WebIDBKeyPath::create(idb_key_path)); | 53 key, value, WebIDBKeyPath::create(WebString(idb_key_path))); |
48 } | 54 } |
49 | 55 |
50 } // namespace webkit_glue | 56 } // namespace webkit_glue |
OLD | NEW |