| 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 "content/common/indexed_db/indexed_db_param_traits.h" | 5 #include "content/common/indexed_db/indexed_db_param_traits.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "content/common/indexed_db/indexed_db_key.h" | 9 #include "content/common/indexed_db/indexed_db_key.h" |
| 10 #include "content/common/indexed_db/indexed_db_key_path.h" | 10 #include "content/common/indexed_db/indexed_db_key_path.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 case WebIDBKeyTypeBinary: { | 77 case WebIDBKeyTypeBinary: { |
| 78 std::string binary; | 78 std::string binary; |
| 79 if (!ReadParam(m, iter, &binary)) | 79 if (!ReadParam(m, iter, &binary)) |
| 80 return false; | 80 return false; |
| 81 *r = IndexedDBKey(binary); | 81 *r = IndexedDBKey(binary); |
| 82 return true; | 82 return true; |
| 83 } | 83 } |
| 84 case WebIDBKeyTypeString: { | 84 case WebIDBKeyTypeString: { |
| 85 string16 string; | 85 base::string16 string; |
| 86 if (!ReadParam(m, iter, &string)) | 86 if (!ReadParam(m, iter, &string)) |
| 87 return false; | 87 return false; |
| 88 *r = IndexedDBKey(string); | 88 *r = IndexedDBKey(string); |
| 89 return true; | 89 return true; |
| 90 } | 90 } |
| 91 case WebIDBKeyTypeDate: | 91 case WebIDBKeyTypeDate: |
| 92 case WebIDBKeyTypeNumber: { | 92 case WebIDBKeyTypeNumber: { |
| 93 double number; | 93 double number; |
| 94 if (!ReadParam(m, iter, &number)) | 94 if (!ReadParam(m, iter, &number)) |
| 95 return false; | 95 return false; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 bool ParamTraits<IndexedDBKeyPath>::Read(const Message* m, | 150 bool ParamTraits<IndexedDBKeyPath>::Read(const Message* m, |
| 151 PickleIterator* iter, | 151 PickleIterator* iter, |
| 152 param_type* r) { | 152 param_type* r) { |
| 153 int type; | 153 int type; |
| 154 if (!ReadParam(m, iter, &type)) | 154 if (!ReadParam(m, iter, &type)) |
| 155 return false; | 155 return false; |
| 156 | 156 |
| 157 switch (type) { | 157 switch (type) { |
| 158 case WebIDBKeyPathTypeArray: { | 158 case WebIDBKeyPathTypeArray: { |
| 159 std::vector<string16> array; | 159 std::vector<base::string16> array; |
| 160 if (!ReadParam(m, iter, &array)) | 160 if (!ReadParam(m, iter, &array)) |
| 161 return false; | 161 return false; |
| 162 *r = IndexedDBKeyPath(array); | 162 *r = IndexedDBKeyPath(array); |
| 163 return true; | 163 return true; |
| 164 } | 164 } |
| 165 case WebIDBKeyPathTypeString: { | 165 case WebIDBKeyPathTypeString: { |
| 166 string16 string; | 166 base::string16 string; |
| 167 if (!ReadParam(m, iter, &string)) | 167 if (!ReadParam(m, iter, &string)) |
| 168 return false; | 168 return false; |
| 169 *r = IndexedDBKeyPath(string); | 169 *r = IndexedDBKeyPath(string); |
| 170 return true; | 170 return true; |
| 171 } | 171 } |
| 172 case WebIDBKeyPathTypeNull: | 172 case WebIDBKeyPathTypeNull: |
| 173 *r = IndexedDBKeyPath(); | 173 *r = IndexedDBKeyPath(); |
| 174 return true; | 174 return true; |
| 175 } | 175 } |
| 176 NOTREACHED(); | 176 NOTREACHED(); |
| 177 return false; | 177 return false; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void ParamTraits<IndexedDBKeyPath>::Log(const param_type& p, std::string* l) { | 180 void ParamTraits<IndexedDBKeyPath>::Log(const param_type& p, std::string* l) { |
| 181 l->append("<IndexedDBKeyPath>("); | 181 l->append("<IndexedDBKeyPath>("); |
| 182 LogParam(static_cast<int>(p.type()), l); | 182 LogParam(static_cast<int>(p.type()), l); |
| 183 l->append(", "); | 183 l->append(", "); |
| 184 LogParam(p.string(), l); | 184 LogParam(p.string(), l); |
| 185 l->append(", "); | 185 l->append(", "); |
| 186 l->append("["); | 186 l->append("["); |
| 187 std::vector<string16>::const_iterator it = p.array().begin(); | 187 std::vector<base::string16>::const_iterator it = p.array().begin(); |
| 188 while (it != p.array().end()) { | 188 while (it != p.array().end()) { |
| 189 LogParam(*it, l); | 189 LogParam(*it, l); |
| 190 ++it; | 190 ++it; |
| 191 if (it != p.array().end()) | 191 if (it != p.array().end()) |
| 192 l->append(", "); | 192 l->append(", "); |
| 193 } | 193 } |
| 194 l->append("])"); | 194 l->append("])"); |
| 195 } | 195 } |
| 196 | 196 |
| 197 void ParamTraits<IndexedDBKeyRange>::Write(Message* m, const param_type& p) { | 197 void ParamTraits<IndexedDBKeyRange>::Write(Message* m, const param_type& p) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 l->append(", upper="); | 230 l->append(", upper="); |
| 231 LogParam(p.upper(), l); | 231 LogParam(p.upper(), l); |
| 232 l->append(", lower_open="); | 232 l->append(", lower_open="); |
| 233 LogParam(p.lowerOpen(), l); | 233 LogParam(p.lowerOpen(), l); |
| 234 l->append(", upper_open="); | 234 l->append(", upper_open="); |
| 235 LogParam(p.upperOpen(), l); | 235 LogParam(p.upperOpen(), l); |
| 236 l->append(")"); | 236 l->append(")"); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace IPC | 239 } // namespace IPC |
| OLD | NEW |