| 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..a5122b06b209b5f204e97606d6f45744b723ddce
|
| --- /dev/null
|
| +++ b/content/browser/indexed_db/indexed_db_struct_traits.cc
|
| @@ -0,0 +1,75 @@
|
| +// 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::DataLoss;
|
| +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;
|
| +}
|
| +
|
| +DataLoss EnumTraits<DataLoss, blink::WebIDBDataLoss>::ToMojom(
|
| + blink::WebIDBDataLoss input) {
|
| + switch (input) {
|
| + case blink::WebIDBDataLossNone:
|
| + return DataLoss::None;
|
| + case blink::WebIDBDataLossTotal:
|
| + return DataLoss::Total;
|
| + }
|
| +
|
| + NOTREACHED();
|
| + return DataLoss::None;
|
| +}
|
| +
|
| +bool EnumTraits<DataLoss, blink::WebIDBDataLoss>::FromMojom(
|
| + DataLoss input,
|
| + blink::WebIDBDataLoss* output) {
|
| + switch (input) {
|
| + case DataLoss::None:
|
| + *output = blink::WebIDBDataLossNone;
|
| + return true;
|
| + case DataLoss::Total:
|
| + *output = blink::WebIDBDataLossTotal;
|
| + return true;
|
| + }
|
| +
|
| + NOTREACHED();
|
| + return false;
|
| +}
|
| +
|
| +} // namespace mojo
|
|
|