| 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/browser/payments/payment_app_manager.h" | 5 #include "content/browser/payments/payment_app_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 | 84 |
| 85 PaymentAppManifestProto manifest_proto; | 85 PaymentAppManifestProto manifest_proto; |
| 86 manifest_proto.set_label(manifest->label); | 86 manifest_proto.set_label(manifest->label); |
| 87 if (manifest->icon) | 87 if (manifest->icon) |
| 88 manifest_proto.set_icon(manifest->icon.value()); | 88 manifest_proto.set_icon(manifest->icon.value()); |
| 89 | 89 |
| 90 for (const auto& option : manifest->options) { | 90 for (const auto& option : manifest->options) { |
| 91 PaymentAppOptionProto* option_proto = manifest_proto.add_options(); | 91 PaymentAppOptionProto* option_proto = manifest_proto.add_options(); |
| 92 option_proto->set_label(option->label); | 92 option_proto->set_name(option->name); |
| 93 if (option->icon) | 93 if (option->icon) |
| 94 option_proto->set_icon(option->icon.value()); | 94 option_proto->set_icon(option->icon.value()); |
| 95 option_proto->set_id(option->id); | 95 option_proto->set_id(option->id); |
| 96 for (const auto& method : option->enabled_methods) { | 96 for (const auto& method : option->enabled_methods) { |
| 97 option_proto->add_enabled_methods(method); | 97 option_proto->add_enabled_methods(method); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 std::string serialized; | 101 std::string serialized; |
| 102 bool success = manifest_proto.SerializeToString(&serialized); | 102 bool success = manifest_proto.SerializeToString(&serialized); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 156 } |
| 157 | 157 |
| 158 payments::mojom::PaymentAppManifestPtr manifest = | 158 payments::mojom::PaymentAppManifestPtr manifest = |
| 159 payments::mojom::PaymentAppManifest::New(); | 159 payments::mojom::PaymentAppManifest::New(); |
| 160 manifest->label = manifest_proto.label(); | 160 manifest->label = manifest_proto.label(); |
| 161 if (manifest_proto.has_icon()) | 161 if (manifest_proto.has_icon()) |
| 162 manifest->icon = manifest_proto.icon(); | 162 manifest->icon = manifest_proto.icon(); |
| 163 for (const auto& option_proto : manifest_proto.options()) { | 163 for (const auto& option_proto : manifest_proto.options()) { |
| 164 payments::mojom::PaymentAppOptionPtr option = | 164 payments::mojom::PaymentAppOptionPtr option = |
| 165 payments::mojom::PaymentAppOption::New(); | 165 payments::mojom::PaymentAppOption::New(); |
| 166 option->label = option_proto.label(); | 166 option->name = option_proto.name(); |
| 167 if (option_proto.has_icon()) | 167 if (option_proto.has_icon()) |
| 168 option->icon = option_proto.icon(); | 168 option->icon = option_proto.icon(); |
| 169 option->id = option_proto.id(); | 169 option->id = option_proto.id(); |
| 170 for (const auto& method : option_proto.enabled_methods()) | 170 for (const auto& method : option_proto.enabled_methods()) |
| 171 option->enabled_methods.push_back(method); | 171 option->enabled_methods.push_back(method); |
| 172 manifest->options.push_back(std::move(option)); | 172 manifest->options.push_back(std::move(option)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 callback.Run(std::move(manifest), | 175 callback.Run(std::move(manifest), |
| 176 payments::mojom::PaymentAppManifestError::NONE); | 176 payments::mojom::PaymentAppManifestError::NONE); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace content | 179 } // namespace content |
| OLD | NEW |