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

Unified Diff: content/common/indexed_db/indexed_db_database_error_struct_traits.h

Issue 2320213004: Port IndexedDB open() and database callbacks to Mojo. (Closed)
Patch Set: Make DatabaseClient an associated interface. Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « content/common/indexed_db/indexed_db_database_error.cc ('k') | content/common/indexed_db/indexed_db_error_info.typemap » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698