Index: content/browser/indexed_db/indexed_db_struct_traits.cc |
diff --git a/content/browser/indexed_db/indexed_db_struct_traits.cc b/content/browser/indexed_db/indexed_db_struct_traits.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b4b0ce880b8b13752930360f3235cf155b075040 |
--- /dev/null |
+++ b/content/browser/indexed_db/indexed_db_struct_traits.cc |
@@ -0,0 +1,45 @@ |
+// 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. |
+ |
+#include "content/browser/indexed_db/indexed_db_struct_traits.h" |
+ |
+using indexed_db::mojom::KeyPathType; |
+ |
+namespace mojo { |
+ |
+KeyPathType EnumTraits<KeyPathType, blink::WebIDBKeyPathType>::ToMojom( |
+ blink::WebIDBKeyPathType input) { |
+ switch (input) { |
+ case blink::WebIDBKeyPathTypeNull: |
+ return KeyPathType::NONE; |
+ case blink::WebIDBKeyPathTypeString: |
+ return KeyPathType::STRING; |
+ case blink::WebIDBKeyPathTypeArray: |
+ return KeyPathType::ARRAY; |
+ } |
+ |
+ NOTREACHED(); |
+ return KeyPathType::NONE; |
+} |
+ |
+bool EnumTraits<KeyPathType, blink::WebIDBKeyPathType>::FromMojom( |
+ KeyPathType input, |
+ blink::WebIDBKeyPathType* output) { |
+ switch (input) { |
+ case KeyPathType::NONE: |
+ *output = blink::WebIDBKeyPathTypeNull; |
+ return true; |
+ case KeyPathType::STRING: |
+ *output = blink::WebIDBKeyPathTypeString; |
+ return true; |
+ case KeyPathType::ARRAY: |
+ *output = blink::WebIDBKeyPathTypeArray; |
+ return true; |
+ } |
+ |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
+} // namespace mojo |