Index: content/common/indexed_db/indexed_db_database_error_struct_traits.h |
diff --git a/content/common/indexed_db/indexed_db_database_error_struct_traits.h b/content/common/indexed_db/indexed_db_database_error_struct_traits.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ab75a95cc201355527b123870650f438bd75cf6d |
--- /dev/null |
+++ b/content/common/indexed_db/indexed_db_database_error_struct_traits.h |
@@ -0,0 +1,37 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_STRUCT_TRAITS_H_ |
+#define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_STRUCT_TRAITS_H_ |
+ |
+#include "content/common/indexed_db/indexed_db_database_error.h" |
+#include "third_party/WebKit/public/platform/modules/indexeddb/indexed_db.mojom.h" |
+ |
+namespace mojo { |
+ |
+template <> |
+struct StructTraits<indexed_db::mojom::ErrorInfoDataView, |
+ content::IndexedDBDatabaseError> { |
+ static int16_t code(const content::IndexedDBDatabaseError& error) { |
+ return error.code(); |
+ } |
+ static const base::string16& message( |
+ const content::IndexedDBDatabaseError& error) { |
+ return error.message(); |
+ } |
+ |
+ static bool Read(indexed_db::mojom::ErrorInfoDataView data, |
+ content::IndexedDBDatabaseError* out) { |
+ base::string16 message; |
+ if (!data.ReadMessage(&message)) |
+ return false; |
+ |
+ *out = content::IndexedDBDatabaseError(data.code(), message); |
+ return true; |
+ } |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DATABASE_ERROR_STRUCT_TRAITS_H_ |