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

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

Issue 2715533002: [Payments] Add error messages to credit card editor. (Closed)
Patch Set: tests Created 3 years, 10 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
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 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/ui/views/payments/editor_view_controller.h" 9 #include "chrome/browser/ui/views/payments/editor_view_controller.h"
10 #include "chrome/browser/ui/views/payments/validation_delegate.h" 10 #include "chrome/browser/ui/views/payments/validation_delegate.h"
(...skipping 10 matching lines...) Expand all
21 // Does not take ownership of the arguments, which should outlive this object. 21 // Does not take ownership of the arguments, which should outlive this object.
22 CreditCardEditorViewController(PaymentRequest* request, 22 CreditCardEditorViewController(PaymentRequest* request,
23 PaymentRequestDialogView* dialog); 23 PaymentRequestDialogView* dialog);
24 ~CreditCardEditorViewController() override; 24 ~CreditCardEditorViewController() override;
25 25
26 // EditorViewController: 26 // EditorViewController:
27 std::unique_ptr<views::View> CreateHeaderView() override; 27 std::unique_ptr<views::View> CreateHeaderView() override;
28 std::vector<EditorField> GetFieldDefinitions() override; 28 std::vector<EditorField> GetFieldDefinitions() override;
29 bool ValidateModelAndSave() override; 29 bool ValidateModelAndSave() override;
30 std::unique_ptr<ValidationDelegate> CreateValidationDelegate( 30 std::unique_ptr<ValidationDelegate> CreateValidationDelegate(
31 const EditorField& field) override; 31 const EditorField& field,
32 EditorViewController* controller) override;
32 std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType( 33 std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType(
33 const autofill::ServerFieldType& type) override; 34 const autofill::ServerFieldType& type) override;
34 35
35 private: 36 private:
36 class CreditCardValidationDelegate : public ValidationDelegate { 37 class CreditCardValidationDelegate : public ValidationDelegate {
37 public: 38 public:
38 explicit CreditCardValidationDelegate(const EditorField& field); 39 explicit CreditCardValidationDelegate(const EditorField& field,
40 EditorViewController* controller);
39 ~CreditCardValidationDelegate() override; 41 ~CreditCardValidationDelegate() override;
40 42
41 // ValidationDelegate: 43 // ValidationDelegate:
42 bool ValidateTextfield(views::Textfield* textfield) override; 44 bool ValidateTextfield(views::Textfield* textfield) override;
43 bool ValidateCombobox(views::Combobox* combobox) override; 45 bool ValidateCombobox(views::Combobox* combobox) override;
44 46
45 private: 47 private:
46 // Validates a specific |value|. 48 // Validates a specific |value|.
47 bool ValidateValue(const base::string16& value); 49 bool ValidateValue(const base::string16& value);
48 50
49 EditorField field_; 51 EditorField field_;
52 // Outlives this class.
53 EditorViewController* controller_;
50 54
51 DISALLOW_COPY_AND_ASSIGN(CreditCardValidationDelegate); 55 DISALLOW_COPY_AND_ASSIGN(CreditCardValidationDelegate);
52 }; 56 };
53 57
54 DISALLOW_COPY_AND_ASSIGN(CreditCardEditorViewController); 58 DISALLOW_COPY_AND_ASSIGN(CreditCardEditorViewController);
55 }; 59 };
56 60
57 } // namespace payments 61 } // namespace payments
58 62
59 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H _ 63 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698