| 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 "components/autofill/content/common/autofill_types_struct_traits.h" | 5 #include "components/autofill/content/common/autofill_types_struct_traits.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "ipc/ipc_message_utils.h" | 8 #include "ipc/ipc_message_utils.h" |
| 9 #include "mojo/common/common_custom_types_struct_traits.h" |
| 9 #include "url/mojo/origin_struct_traits.h" | 10 #include "url/mojo/origin_struct_traits.h" |
| 10 #include "url/mojo/url_gurl_struct_traits.h" | 11 #include "url/mojo/url_gurl_struct_traits.h" |
| 11 | 12 |
| 12 using namespace autofill; | 13 using namespace autofill; |
| 13 | 14 |
| 14 namespace mojo { | 15 namespace mojo { |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 mojom::CheckStatus | 18 mojom::CheckStatus |
| 18 EnumTraits<mojom::CheckStatus, FormFieldData::CheckStatus>::ToMojom( | 19 EnumTraits<mojom::CheckStatus, FormFieldData::CheckStatus>::ToMojom( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 case mojom::RoleAttribute::ROLE_ATTRIBUTE_OTHER: | 77 case mojom::RoleAttribute::ROLE_ATTRIBUTE_OTHER: |
| 77 *output = FormFieldData::RoleAttribute::ROLE_ATTRIBUTE_OTHER; | 78 *output = FormFieldData::RoleAttribute::ROLE_ATTRIBUTE_OTHER; |
| 78 return true; | 79 return true; |
| 79 } | 80 } |
| 80 | 81 |
| 81 NOTREACHED(); | 82 NOTREACHED(); |
| 82 return false; | 83 return false; |
| 83 } | 84 } |
| 84 | 85 |
| 85 // static | 86 // static |
| 86 mojom::TextDirection | |
| 87 EnumTraits<mojom::TextDirection, base::i18n::TextDirection>::ToMojom( | |
| 88 base::i18n::TextDirection input) { | |
| 89 switch (input) { | |
| 90 case base::i18n::TextDirection::UNKNOWN_DIRECTION: | |
| 91 return mojom::TextDirection::UNKNOWN_DIRECTION; | |
| 92 case base::i18n::TextDirection::RIGHT_TO_LEFT: | |
| 93 return mojom::TextDirection::RIGHT_TO_LEFT; | |
| 94 case base::i18n::TextDirection::LEFT_TO_RIGHT: | |
| 95 return mojom::TextDirection::LEFT_TO_RIGHT; | |
| 96 case base::i18n::TextDirection::TEXT_DIRECTION_NUM_DIRECTIONS: | |
| 97 return mojom::TextDirection::TEXT_DIRECTION_NUM_DIRECTIONS; | |
| 98 } | |
| 99 | |
| 100 NOTREACHED(); | |
| 101 return mojom::TextDirection::UNKNOWN_DIRECTION; | |
| 102 } | |
| 103 | |
| 104 // static | |
| 105 bool EnumTraits<mojom::TextDirection, base::i18n::TextDirection>::FromMojom( | |
| 106 mojom::TextDirection input, | |
| 107 base::i18n::TextDirection* output) { | |
| 108 switch (input) { | |
| 109 case mojom::TextDirection::UNKNOWN_DIRECTION: | |
| 110 *output = base::i18n::TextDirection::UNKNOWN_DIRECTION; | |
| 111 return true; | |
| 112 case mojom::TextDirection::RIGHT_TO_LEFT: | |
| 113 *output = base::i18n::TextDirection::RIGHT_TO_LEFT; | |
| 114 return true; | |
| 115 case mojom::TextDirection::LEFT_TO_RIGHT: | |
| 116 *output = base::i18n::TextDirection::LEFT_TO_RIGHT; | |
| 117 return true; | |
| 118 case mojom::TextDirection::TEXT_DIRECTION_NUM_DIRECTIONS: | |
| 119 *output = base::i18n::TextDirection::TEXT_DIRECTION_NUM_DIRECTIONS; | |
| 120 return true; | |
| 121 } | |
| 122 | |
| 123 NOTREACHED(); | |
| 124 return false; | |
| 125 } | |
| 126 | |
| 127 // static | |
| 128 mojom::GenerationUploadStatus EnumTraits<mojom::GenerationUploadStatus, | 87 mojom::GenerationUploadStatus EnumTraits<mojom::GenerationUploadStatus, |
| 129 PasswordForm::GenerationUploadStatus>:: | 88 PasswordForm::GenerationUploadStatus>:: |
| 130 ToMojom(PasswordForm::GenerationUploadStatus input) { | 89 ToMojom(PasswordForm::GenerationUploadStatus input) { |
| 131 switch (input) { | 90 switch (input) { |
| 132 case PasswordForm::GenerationUploadStatus::NO_SIGNAL_SENT: | 91 case PasswordForm::GenerationUploadStatus::NO_SIGNAL_SENT: |
| 133 return mojom::GenerationUploadStatus::NO_SIGNAL_SENT; | 92 return mojom::GenerationUploadStatus::NO_SIGNAL_SENT; |
| 134 case PasswordForm::GenerationUploadStatus::POSITIVE_SIGNAL_SENT: | 93 case PasswordForm::GenerationUploadStatus::POSITIVE_SIGNAL_SENT: |
| 135 return mojom::GenerationUploadStatus::POSITIVE_SIGNAL_SENT; | 94 return mojom::GenerationUploadStatus::POSITIVE_SIGNAL_SENT; |
| 136 case PasswordForm::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT: | 95 case PasswordForm::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT: |
| 137 return mojom::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT; | 96 return mojom::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT; |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 if (keys.size() != values.size()) | 615 if (keys.size() != values.size()) |
| 657 return false; | 616 return false; |
| 658 out->clear(); | 617 out->clear(); |
| 659 for (size_t i = 0; i < keys.size(); ++i) | 618 for (size_t i = 0; i < keys.size(); ++i) |
| 660 out->insert({keys[i], values[i]}); | 619 out->insert({keys[i], values[i]}); |
| 661 | 620 |
| 662 return true; | 621 return true; |
| 663 } | 622 } |
| 664 | 623 |
| 665 } // namespace mojo | 624 } // namespace mojo |
| OLD | NEW |