Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: chrome/browser/ui/views/payments/credit_card_editor_view_controller.cc

Issue 2741343011: [Payments] Move PersonalDataManager and locale to PaymentRequestState (Closed)
Patch Set: Initial Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/order_summary_view_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h" 5 #include "chrome/browser/ui/views/payments/credit_card_editor_view_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 183
184 credit_card.SetRawInfo(field.second.type, 184 credit_card.SetRawInfo(field.second.type,
185 combobox->GetTextForRow(combobox->selected_index())); 185 combobox->GetTextForRow(combobox->selected_index()));
186 } 186 }
187 187
188 // TODO(mathp): Display global error message. 188 // TODO(mathp): Display global error message.
189 if (!credit_card.IsValid()) 189 if (!credit_card.IsValid())
190 return false; 190 return false;
191 191
192 // Add the card (will not add a duplicate). 192 // Add the card (will not add a duplicate).
193 request()->GetPersonalDataManager()->AddCreditCard(credit_card); 193 request()->state()->GetPersonalDataManager()->AddCreditCard(credit_card);
194 194
195 return true; 195 return true;
196 } 196 }
197 197
198 std::unique_ptr<ValidationDelegate> 198 std::unique_ptr<ValidationDelegate>
199 CreditCardEditorViewController::CreateValidationDelegate( 199 CreditCardEditorViewController::CreateValidationDelegate(
200 const EditorField& field) { 200 const EditorField& field) {
201 // The supported card networks for non-cc-number types are not passed to avoid 201 // The supported card networks for non-cc-number types are not passed to avoid
202 // the data copy in the delegate. 202 // the data copy in the delegate.
203 return base::MakeUnique< 203 return base::MakeUnique<
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 bool is_required_valid = !field_.required; 267 bool is_required_valid = !field_.required;
268 const base::string16 displayed_message = 268 const base::string16 displayed_message =
269 is_required_valid ? base::ASCIIToUTF16("") 269 is_required_valid ? base::ASCIIToUTF16("")
270 : l10n_util::GetStringUTF16( 270 : l10n_util::GetStringUTF16(
271 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE); 271 IDS_PAYMENTS_FIELD_REQUIRED_VALIDATION_MESSAGE);
272 controller_->DisplayErrorMessageForField(field_, displayed_message); 272 controller_->DisplayErrorMessageForField(field_, displayed_message);
273 return is_required_valid; 273 return is_required_valid;
274 } 274 }
275 275
276 } // namespace payments 276 } // namespace payments
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/payments/order_summary_view_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698