Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: content/child/indexed_db/indexed_db_key_builders.cc

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/child/indexed_db/indexed_db_key_builders.h" 5 #include "content/child/indexed_db/indexed_db_key_builders.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebVector.h" 8 #include "third_party/WebKit/public/platform/WebVector.h"
9 9
10 using WebKit::WebIDBKey; 10 using blink::WebIDBKey;
11 using WebKit::WebIDBKeyRange; 11 using blink::WebIDBKeyRange;
12 using WebKit::WebIDBKeyTypeArray; 12 using blink::WebIDBKeyTypeArray;
13 using WebKit::WebIDBKeyTypeDate; 13 using blink::WebIDBKeyTypeDate;
14 using WebKit::WebIDBKeyTypeInvalid; 14 using blink::WebIDBKeyTypeInvalid;
15 using WebKit::WebIDBKeyTypeMin; 15 using blink::WebIDBKeyTypeMin;
16 using WebKit::WebIDBKeyTypeNull; 16 using blink::WebIDBKeyTypeNull;
17 using WebKit::WebIDBKeyTypeNumber; 17 using blink::WebIDBKeyTypeNumber;
18 using WebKit::WebIDBKeyTypeString; 18 using blink::WebIDBKeyTypeString;
19 using WebKit::WebVector; 19 using blink::WebVector;
20 using WebKit::WebString; 20 using blink::WebString;
21 21
22 static content::IndexedDBKey::KeyArray CopyKeyArray(const WebIDBKey& other) { 22 static content::IndexedDBKey::KeyArray CopyKeyArray(const WebIDBKey& other) {
23 content::IndexedDBKey::KeyArray result; 23 content::IndexedDBKey::KeyArray result;
24 if (other.keyType() == WebIDBKeyTypeArray) { 24 if (other.keyType() == WebIDBKeyTypeArray) {
25 const WebVector<WebIDBKey>& array = other.array(); 25 const WebVector<WebIDBKey>& array = other.array();
26 for (size_t i = 0; i < array.size(); ++i) 26 for (size_t i = 0; i < array.size(); ++i)
27 result.push_back(content::IndexedDBKeyBuilder::Build(array[i])); 27 result.push_back(content::IndexedDBKeyBuilder::Build(array[i]));
28 } 28 }
29 return result; 29 return result;
30 } 30 }
31 31
32 static std::vector<string16> CopyArray( 32 static std::vector<string16> CopyArray(
33 const WebVector<WebString>& array) { 33 const WebVector<WebString>& array) {
34 std::vector<string16> copy(array.size()); 34 std::vector<string16> copy(array.size());
35 for (size_t i = 0; i < array.size(); ++i) 35 for (size_t i = 0; i < array.size(); ++i)
36 copy[i] = array[i]; 36 copy[i] = array[i];
37 return copy; 37 return copy;
38 } 38 }
39 39
40 40
41 namespace content { 41 namespace content {
42 42
43 IndexedDBKey IndexedDBKeyBuilder::Build(const WebKit::WebIDBKey& key) { 43 IndexedDBKey IndexedDBKeyBuilder::Build(const blink::WebIDBKey& key) {
44 switch (key.keyType()) { 44 switch (key.keyType()) {
45 case WebIDBKeyTypeArray: 45 case WebIDBKeyTypeArray:
46 return IndexedDBKey(CopyKeyArray(key)); 46 return IndexedDBKey(CopyKeyArray(key));
47 case WebIDBKeyTypeString: 47 case WebIDBKeyTypeString:
48 return IndexedDBKey(key.string()); 48 return IndexedDBKey(key.string());
49 case WebIDBKeyTypeDate: 49 case WebIDBKeyTypeDate:
50 return IndexedDBKey(key.date(), WebIDBKeyTypeDate); 50 return IndexedDBKey(key.date(), WebIDBKeyTypeDate);
51 case WebIDBKeyTypeNumber: 51 case WebIDBKeyTypeNumber:
52 return IndexedDBKey(key.number(), WebIDBKeyTypeNumber); 52 return IndexedDBKey(key.number(), WebIDBKeyTypeNumber);
53 case WebIDBKeyTypeNull: 53 case WebIDBKeyTypeNull:
54 case WebIDBKeyTypeInvalid: 54 case WebIDBKeyTypeInvalid:
55 return IndexedDBKey(key.keyType()); 55 return IndexedDBKey(key.keyType());
56 case WebIDBKeyTypeMin: 56 case WebIDBKeyTypeMin:
57 default: 57 default:
58 NOTREACHED(); 58 NOTREACHED();
59 return IndexedDBKey(); 59 return IndexedDBKey();
60 } 60 }
61 NOTREACHED(); 61 NOTREACHED();
62 return IndexedDBKey(); 62 return IndexedDBKey();
63 } 63 }
64 64
65 WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) { 65 WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) {
66 switch (key.type()) { 66 switch (key.type()) {
67 case WebIDBKeyTypeArray: { 67 case WebIDBKeyTypeArray: {
68 const IndexedDBKey::KeyArray& array = key.array(); 68 const IndexedDBKey::KeyArray& array = key.array();
69 WebKit::WebVector<WebIDBKey> web_array(array.size()); 69 blink::WebVector<WebIDBKey> web_array(array.size());
70 for (size_t i = 0; i < array.size(); ++i) { 70 for (size_t i = 0; i < array.size(); ++i) {
71 web_array[i] = Build(array[i]); 71 web_array[i] = Build(array[i]);
72 } 72 }
73 return WebIDBKey::createArray(web_array); 73 return WebIDBKey::createArray(web_array);
74 } 74 }
75 case WebIDBKeyTypeString: 75 case WebIDBKeyTypeString:
76 return WebIDBKey::createString(key.string()); 76 return WebIDBKey::createString(key.string());
77 case WebIDBKeyTypeDate: 77 case WebIDBKeyTypeDate:
78 return WebIDBKey::createDate(key.date()); 78 return WebIDBKey::createDate(key.date());
79 case WebIDBKeyTypeNumber: 79 case WebIDBKeyTypeNumber:
(...skipping 14 matching lines...) Expand all
94 IndexedDBKeyRange IndexedDBKeyRangeBuilder::Build( 94 IndexedDBKeyRange IndexedDBKeyRangeBuilder::Build(
95 const WebIDBKeyRange& key_range) { 95 const WebIDBKeyRange& key_range) {
96 return IndexedDBKeyRange( 96 return IndexedDBKeyRange(
97 IndexedDBKeyBuilder::Build(key_range.lower()), 97 IndexedDBKeyBuilder::Build(key_range.lower()),
98 IndexedDBKeyBuilder::Build(key_range.upper()), 98 IndexedDBKeyBuilder::Build(key_range.upper()),
99 key_range.lowerOpen(), 99 key_range.lowerOpen(),
100 key_range.upperOpen()); 100 key_range.upperOpen());
101 } 101 }
102 102
103 IndexedDBKeyPath IndexedDBKeyPathBuilder::Build( 103 IndexedDBKeyPath IndexedDBKeyPathBuilder::Build(
104 const WebKit::WebIDBKeyPath& key_path) { 104 const blink::WebIDBKeyPath& key_path) {
105 switch (key_path.keyPathType()) { 105 switch (key_path.keyPathType()) {
106 case WebKit::WebIDBKeyPathTypeString: 106 case blink::WebIDBKeyPathTypeString:
107 return IndexedDBKeyPath(key_path.string()); 107 return IndexedDBKeyPath(key_path.string());
108 case WebKit::WebIDBKeyPathTypeArray: 108 case blink::WebIDBKeyPathTypeArray:
109 return IndexedDBKeyPath(CopyArray(key_path.array())); 109 return IndexedDBKeyPath(CopyArray(key_path.array()));
110 case WebKit::WebIDBKeyPathTypeNull: 110 case blink::WebIDBKeyPathTypeNull:
111 return IndexedDBKeyPath(); 111 return IndexedDBKeyPath();
112 } 112 }
113 NOTREACHED(); 113 NOTREACHED();
114 return IndexedDBKeyPath(); 114 return IndexedDBKeyPath();
115 } 115 }
116 116
117 WebKit::WebIDBKeyPath WebIDBKeyPathBuilder::Build( 117 blink::WebIDBKeyPath WebIDBKeyPathBuilder::Build(
118 const IndexedDBKeyPath& key_path) { 118 const IndexedDBKeyPath& key_path) {
119 switch (key_path.type()) { 119 switch (key_path.type()) {
120 case WebKit::WebIDBKeyPathTypeString: 120 case blink::WebIDBKeyPathTypeString:
121 return WebKit::WebIDBKeyPath::create(WebString(key_path.string())); 121 return blink::WebIDBKeyPath::create(WebString(key_path.string()));
122 case WebKit::WebIDBKeyPathTypeArray: 122 case blink::WebIDBKeyPathTypeArray:
123 return WebKit::WebIDBKeyPath::create(CopyArray(key_path.array())); 123 return blink::WebIDBKeyPath::create(CopyArray(key_path.array()));
124 case WebKit::WebIDBKeyPathTypeNull: 124 case blink::WebIDBKeyPathTypeNull:
125 return WebKit::WebIDBKeyPath::createNull(); 125 return blink::WebIDBKeyPath::createNull();
126 } 126 }
127 NOTREACHED(); 127 NOTREACHED();
128 return WebKit::WebIDBKeyPath::createNull(); 128 return blink::WebIDBKeyPath::createNull();
129 } 129 }
130 130
131 } // namespace content 131 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/indexed_db_key_builders.h ('k') | content/child/indexed_db/proxy_webidbcursor_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698