| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 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) override; |
| 32 std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType( | 32 std::unique_ptr<ui::ComboboxModel> GetComboboxModelForType( |
| 33 const autofill::ServerFieldType& type) override; | 33 const autofill::ServerFieldType& type) override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 class CreditCardValidationDelegate : public ValidationDelegate { | 36 class CreditCardValidationDelegate : public ValidationDelegate { |
| 37 public: | 37 public: |
| 38 explicit CreditCardValidationDelegate(const EditorField& field); | 38 CreditCardValidationDelegate(const EditorField& field, |
| 39 EditorViewController* controller); |
| 39 ~CreditCardValidationDelegate() override; | 40 ~CreditCardValidationDelegate() override; |
| 40 | 41 |
| 41 // ValidationDelegate: | 42 // ValidationDelegate: |
| 42 bool ValidateTextfield(views::Textfield* textfield) override; | 43 bool ValidateTextfield(views::Textfield* textfield) override; |
| 43 bool ValidateCombobox(views::Combobox* combobox) override; | 44 bool ValidateCombobox(views::Combobox* combobox) override; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 // Validates a specific |value|. | 47 // Validates a specific |value|. |
| 47 bool ValidateValue(const base::string16& value); | 48 bool ValidateValue(const base::string16& value); |
| 48 | 49 |
| 49 EditorField field_; | 50 EditorField field_; |
| 51 // Outlives this class. |
| 52 EditorViewController* controller_; |
| 50 | 53 |
| 51 DISALLOW_COPY_AND_ASSIGN(CreditCardValidationDelegate); | 54 DISALLOW_COPY_AND_ASSIGN(CreditCardValidationDelegate); |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 DISALLOW_COPY_AND_ASSIGN(CreditCardEditorViewController); | 57 DISALLOW_COPY_AND_ASSIGN(CreditCardEditorViewController); |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace payments | 60 } // namespace payments |
| 58 | 61 |
| 59 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H
_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_CREDIT_CARD_EDITOR_VIEW_CONTROLLER_H
_ |
| OLD | NEW |