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
3 // found in the LICENSE file.
5 #include "webkit/glue/idb_bindings.h"
7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/utf_string_conversions.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
15 namespace webkit_glue
{
17 using WebKit::WebIDBKey
;
18 using WebKit::WebIDBKeyPath
;
19 using WebKit::WebSerializedScriptValue
;
20 using WebKit::WebString
;
22 void IDBKeysFromValuesAndKeyPath(
23 const std::vector
<WebSerializedScriptValue
>& serialized_script_values
,
24 const WebIDBKeyPath
& idb_key_path
,
25 std::vector
<WebIDBKey
>* values
) {
26 for (std::vector
<WebSerializedScriptValue
>::const_iterator i
=
27 serialized_script_values
.begin();
28 i
!= serialized_script_values
.end(); ++i
) {
30 WebIDBKey::createFromValueAndKeyPath(*i
, idb_key_path
));
34 WebSerializedScriptValue
InjectIDBKey(
36 const WebSerializedScriptValue
& value
,
37 const WebIDBKeyPath
& idb_key_path
) {
38 return WebIDBKey::injectIDBKeyIntoSerializedValue(
39 key
, value
, idb_key_path
);
42 } // namespace webkit_glue