| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/indexed_db/indexed_db_enum_traits.h" | 5 #include "content/common/indexed_db/indexed_db_enum_traits.h" |
| 6 | 6 |
| 7 using indexed_db::mojom::CursorDirection; | 7 using indexed_db::mojom::CursorDirection; |
| 8 using indexed_db::mojom::DataLoss; | 8 using indexed_db::mojom::DataLoss; |
| 9 using indexed_db::mojom::OperationType; |
| 9 using indexed_db::mojom::PutMode; | 10 using indexed_db::mojom::PutMode; |
| 10 using indexed_db::mojom::TaskType; | 11 using indexed_db::mojom::TaskType; |
| 11 using indexed_db::mojom::TransactionMode; | 12 using indexed_db::mojom::TransactionMode; |
| 12 | 13 |
| 13 namespace mojo { | 14 namespace mojo { |
| 14 | 15 |
| 15 // static | 16 // static |
| 16 CursorDirection | 17 CursorDirection |
| 17 EnumTraits<CursorDirection, blink::WebIDBCursorDirection>::ToMojom( | 18 EnumTraits<CursorDirection, blink::WebIDBCursorDirection>::ToMojom( |
| 18 blink::WebIDBCursorDirection input) { | 19 blink::WebIDBCursorDirection input) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 *output = blink::WebIDBDataLossNone; | 72 *output = blink::WebIDBDataLossNone; |
| 72 return true; | 73 return true; |
| 73 case DataLoss::Total: | 74 case DataLoss::Total: |
| 74 *output = blink::WebIDBDataLossTotal; | 75 *output = blink::WebIDBDataLossTotal; |
| 75 return true; | 76 return true; |
| 76 } | 77 } |
| 77 return false; | 78 return false; |
| 78 } | 79 } |
| 79 | 80 |
| 80 // static | 81 // static |
| 82 OperationType EnumTraits<OperationType, blink::WebIDBOperationType>::ToMojom( |
| 83 blink::WebIDBOperationType input) { |
| 84 switch (input) { |
| 85 case blink::WebIDBAdd: |
| 86 return OperationType::Add; |
| 87 case blink::WebIDBPut: |
| 88 return OperationType::Put; |
| 89 case blink::WebIDBDelete: |
| 90 return OperationType::Delete; |
| 91 case blink::WebIDBClear: |
| 92 return OperationType::Clear; |
| 93 case blink::WebIDBOperationTypeCount: |
| 94 NOTREACHED(); |
| 95 return OperationType::Add; |
| 96 } |
| 97 } |
| 98 |
| 99 // static |
| 100 bool EnumTraits<OperationType, blink::WebIDBOperationType>::FromMojom( |
| 101 OperationType input, |
| 102 blink::WebIDBOperationType* output) { |
| 103 switch (input) { |
| 104 case OperationType::Add: |
| 105 *output = blink::WebIDBAdd; |
| 106 return true; |
| 107 case OperationType::Put: |
| 108 *output = blink::WebIDBPut; |
| 109 return true; |
| 110 case OperationType::Delete: |
| 111 *output = blink::WebIDBDelete; |
| 112 return true; |
| 113 case OperationType::Clear: |
| 114 *output = blink::WebIDBClear; |
| 115 return true; |
| 116 } |
| 117 return false; |
| 118 } |
| 119 |
| 120 // static |
| 81 PutMode EnumTraits<PutMode, blink::WebIDBPutMode>::ToMojom( | 121 PutMode EnumTraits<PutMode, blink::WebIDBPutMode>::ToMojom( |
| 82 blink::WebIDBPutMode input) { | 122 blink::WebIDBPutMode input) { |
| 83 switch (input) { | 123 switch (input) { |
| 84 case blink::WebIDBPutModeAddOrUpdate: | 124 case blink::WebIDBPutModeAddOrUpdate: |
| 85 return PutMode::AddOrUpdate; | 125 return PutMode::AddOrUpdate; |
| 86 case blink::WebIDBPutModeAddOnly: | 126 case blink::WebIDBPutModeAddOnly: |
| 87 return PutMode::AddOnly; | 127 return PutMode::AddOnly; |
| 88 case blink::WebIDBPutModeCursorUpdate: | 128 case blink::WebIDBPutModeCursorUpdate: |
| 89 return PutMode::CursorUpdate; | 129 return PutMode::CursorUpdate; |
| 90 } | 130 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 *output = blink::WebIDBTransactionModeReadWrite; | 202 *output = blink::WebIDBTransactionModeReadWrite; |
| 163 return true; | 203 return true; |
| 164 case TransactionMode::VersionChange: | 204 case TransactionMode::VersionChange: |
| 165 *output = blink::WebIDBTransactionModeVersionChange; | 205 *output = blink::WebIDBTransactionModeVersionChange; |
| 166 return true; | 206 return true; |
| 167 } | 207 } |
| 168 return false; | 208 return false; |
| 169 } | 209 } |
| 170 | 210 |
| 171 } // namespace mojo | 211 } // namespace mojo |
| OLD | NEW |