| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_COCOA_AUTOFILL_AUTOFILL_SECTION_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_SECTION_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_SECTION_CONTAINER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_SECTION_CONTAINER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 13 #import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h" | 13 #import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h" |
| 14 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h" | 14 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h" |
| 15 | 15 |
| 16 namespace autofill { | 16 namespace autofill { |
| 17 class AutofillDialogController; | 17 class AutofillDialogViewDelegate; |
| 18 } | 18 } |
| 19 | 19 |
| 20 @class AutofillSectionView; | 20 @class AutofillSectionView; |
| 21 @class AutofillSuggestionContainer; | 21 @class AutofillSuggestionContainer; |
| 22 @class LayoutView; | 22 @class LayoutView; |
| 23 @class MenuButton; | 23 @class MenuButton; |
| 24 @class MenuController; | 24 @class MenuController; |
| 25 | 25 |
| 26 // Delegate to handle display of validation messages. | 26 // Delegate to handle display of validation messages. |
| 27 @protocol AutofillValidationDisplay | 27 @protocol AutofillValidationDisplay |
| 28 | 28 |
| 29 // Updates the validation message for a given field. | 29 // Updates the validation message for a given field. |
| 30 - (void)updateMessageForField:(NSControl<AutofillInputField>*)field; | 30 - (void)updateMessageForField:(NSControl<AutofillInputField>*)field; |
| 31 | 31 |
| 32 @end | 32 @end |
| 33 | 33 |
| 34 | 34 |
| 35 // View controller for a section of the payment details. Contains a label | 35 // View delegate for a section of the payment details. Contains a label |
| 36 // describing the section as well as associated inputs and controls. Built | 36 // describing the section as well as associated inputs and controls. Built |
| 37 // dynamically based on data retrieved from AutofillDialogController. | 37 // dynamically based on data retrieved from AutofillDialogViewDelegate. |
| 38 @interface AutofillSectionContainer : | 38 @interface AutofillSectionContainer : |
| 39 NSViewController<AutofillLayout, AutofillInputDelegate> { | 39 NSViewController<AutofillLayout, AutofillInputDelegate> { |
| 40 @private | 40 @private |
| 41 base::scoped_nsobject<LayoutView> inputs_; | 41 base::scoped_nsobject<LayoutView> inputs_; |
| 42 base::scoped_nsobject<MenuButton> suggestButton_; | 42 base::scoped_nsobject<MenuButton> suggestButton_; |
| 43 base::scoped_nsobject<AutofillSuggestionContainer> suggestContainer_; | 43 base::scoped_nsobject<AutofillSuggestionContainer> suggestContainer_; |
| 44 base::scoped_nsobject<NSTextField> label_; | 44 base::scoped_nsobject<NSTextField> label_; |
| 45 | 45 |
| 46 // The view for the container. | 46 // The view for the container. |
| 47 base::scoped_nsobject<AutofillSectionView> view_; | 47 base::scoped_nsobject<AutofillSectionView> view_; |
| 48 | 48 |
| 49 // List of weak pointers, which constitute unique field IDs. | 49 // List of weak pointers, which constitute unique field IDs. |
| 50 std::vector<const autofill::DetailInput*> detailInputs_; | 50 std::vector<const autofill::DetailInput*> detailInputs_; |
| 51 | 51 |
| 52 // A delegate to handle display of validation messages. Not owned. | 52 // A delegate to handle display of validation messages. Not owned. |
| 53 id<AutofillValidationDisplay> validationDelegate_; | 53 id<AutofillValidationDisplay> validationDelegate_; |
| 54 | 54 |
| 55 base::scoped_nsobject<MenuController> menuController_; | 55 base::scoped_nsobject<MenuController> menuController_; |
| 56 autofill::DialogSection section_; | 56 autofill::DialogSection section_; |
| 57 autofill::AutofillDialogController* controller_; // Not owned. | 57 autofill::AutofillDialogViewDelegate* delegate_; // Not owned. |
| 58 } | 58 } |
| 59 | 59 |
| 60 @property(readonly, nonatomic) autofill::DialogSection section; | 60 @property(readonly, nonatomic) autofill::DialogSection section; |
| 61 @property(assign, nonatomic) id<AutofillValidationDisplay> validationDelegate; | 61 @property(assign, nonatomic) id<AutofillValidationDisplay> validationDelegate; |
| 62 | 62 |
| 63 // Designated initializer. Queries |controller| for the list of desired input | 63 // Designated initializer. Queries |delegate| for the list of desired input |
| 64 // fields for |section|. | 64 // fields for |section|. |
| 65 - (id)initWithController:(autofill::AutofillDialogController*)controller | 65 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate |
| 66 forSection:(autofill::DialogSection)section; | 66 forSection:(autofill::DialogSection)section; |
| 67 | 67 |
| 68 // Populates |output| with mappings from field identification to input value. | 68 // Populates |output| with mappings from field identification to input value. |
| 69 - (void)getInputs:(autofill::DetailOutputMap*)output; | 69 - (void)getInputs:(autofill::DetailOutputMap*)output; |
| 70 | 70 |
| 71 // Called when the controller-maintained suggestions model has changed. | 71 // Called when the delegate-maintained suggestions model has changed. |
| 72 - (void)modelChanged; | 72 - (void)modelChanged; |
| 73 | 73 |
| 74 // Called when the contents of a section have changed. | 74 // Called when the contents of a section have changed. |
| 75 - (void)update; | 75 - (void)update; |
| 76 | 76 |
| 77 // Fills the section with Autofill data that was triggered by a user | 77 // Fills the section with Autofill data that was triggered by a user |
| 78 // interaction with the originating |input|. | 78 // interaction with the originating |input|. |
| 79 - (void)fillForInput:(const autofill::DetailInput&)input; | 79 - (void)fillForInput:(const autofill::DetailInput&)input; |
| 80 | 80 |
| 81 // Validate this section. Validation rules depend on |validationType|. | 81 // Validate this section. Validation rules depend on |validationType|. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 96 // Sets the value for the suggestion text field. | 96 // Sets the value for the suggestion text field. |
| 97 - (void)setSuggestionFieldValue:(NSString*)text; | 97 - (void)setSuggestionFieldValue:(NSString*)text; |
| 98 | 98 |
| 99 // Activates a given input field, determined by |input|. Does nothing if the | 99 // Activates a given input field, determined by |input|. Does nothing if the |
| 100 // field is not part of this section. | 100 // field is not part of this section. |
| 101 - (void)activateFieldForInput:(const autofill::DetailInput&)input; | 101 - (void)activateFieldForInput:(const autofill::DetailInput&)input; |
| 102 | 102 |
| 103 @end | 103 @end |
| 104 | 104 |
| 105 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_SECTION_CONTAINER_H_ | 105 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_SECTION_CONTAINER_H_ |
| OLD | NEW |