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 #include "content/browser/indexed_db/indexed_db_struct_traits.h" |
| 6 |
| 7 using indexed_db::mojom::DataLoss; |
| 8 using indexed_db::mojom::KeyPathType; |
| 9 |
| 10 namespace mojo { |
| 11 |
| 12 KeyPathType EnumTraits<KeyPathType, blink::WebIDBKeyPathType>::ToMojom( |
| 13 blink::WebIDBKeyPathType input) { |
| 14 switch (input) { |
| 15 case blink::WebIDBKeyPathTypeNull: |
| 16 return KeyPathType::NONE; |
| 17 case blink::WebIDBKeyPathTypeString: |
| 18 return KeyPathType::STRING; |
| 19 case blink::WebIDBKeyPathTypeArray: |
| 20 return KeyPathType::ARRAY; |
| 21 } |
| 22 |
| 23 NOTREACHED(); |
| 24 return KeyPathType::NONE; |
| 25 } |
| 26 |
| 27 bool EnumTraits<KeyPathType, blink::WebIDBKeyPathType>::FromMojom( |
| 28 KeyPathType input, |
| 29 blink::WebIDBKeyPathType* output) { |
| 30 switch (input) { |
| 31 case KeyPathType::NONE: |
| 32 *output = blink::WebIDBKeyPathTypeNull; |
| 33 return true; |
| 34 case KeyPathType::STRING: |
| 35 *output = blink::WebIDBKeyPathTypeString; |
| 36 return true; |
| 37 case KeyPathType::ARRAY: |
| 38 *output = blink::WebIDBKeyPathTypeArray; |
| 39 return true; |
| 40 } |
| 41 |
| 42 NOTREACHED(); |
| 43 return false; |
| 44 } |
| 45 |
| 46 DataLoss EnumTraits<DataLoss, blink::WebIDBDataLoss>::ToMojom( |
| 47 blink::WebIDBDataLoss input) { |
| 48 switch (input) { |
| 49 case blink::WebIDBDataLossNone: |
| 50 return DataLoss::None; |
| 51 case blink::WebIDBDataLossTotal: |
| 52 return DataLoss::Total; |
| 53 } |
| 54 |
| 55 NOTREACHED(); |
| 56 return DataLoss::None; |
| 57 } |
| 58 |
| 59 bool EnumTraits<DataLoss, blink::WebIDBDataLoss>::FromMojom( |
| 60 DataLoss input, |
| 61 blink::WebIDBDataLoss* output) { |
| 62 switch (input) { |
| 63 case DataLoss::None: |
| 64 *output = blink::WebIDBDataLossNone; |
| 65 return true; |
| 66 case DataLoss::Total: |
| 67 *output = blink::WebIDBDataLossTotal; |
| 68 return true; |
| 69 } |
| 70 |
| 71 NOTREACHED(); |
| 72 return false; |
| 73 } |
| 74 |
| 75 } // namespace mojo |
OLD | NEW |