OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_STRUCT_TRAITS_H_ |
| 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_STRUCT_TRAITS_H_ |
| 7 |
| 8 #include "content/common/indexed_db/indexed_db_database_error.h" |
| 9 #include "third_party/WebKit/public/platform/modules/indexeddb/indexed_db.mojom.
h" |
| 10 |
| 11 namespace mojo { |
| 12 |
| 13 template <> |
| 14 struct StructTraits<indexed_db::mojom::ErrorInfoDataView, |
| 15 content::IndexedDBDatabaseError> { |
| 16 static int16_t code(const content::IndexedDBDatabaseError& error) { |
| 17 return error.code(); |
| 18 } |
| 19 static const base::string16& message( |
| 20 const content::IndexedDBDatabaseError& error) { |
| 21 return error.message(); |
| 22 } |
| 23 |
| 24 static bool Read(indexed_db::mojom::ErrorInfoDataView data, |
| 25 content::IndexedDBDatabaseError* out) { |
| 26 base::string16 message; |
| 27 if (!data.ReadMessage(&message)) |
| 28 return false; |
| 29 |
| 30 *out = content::IndexedDBDatabaseError(data.code(), message); |
| 31 return true; |
| 32 } |
| 33 }; |
| 34 |
| 35 } // namespace mojo |
| 36 |
| 37 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_STRUCT_TRAITS_H_ |
OLD | NEW |