Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / autofill / autofill_main_container.h
blob8496753f1e7fd7b8ede56a2425494fdf840db48d
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
12 #import "chrome/browser/ui/cocoa/autofill/autofill_layout.h"
13 #include "components/autofill/core/browser/dialog_section.h"
15 @class AutofillDetailsContainer;
16 @class AutofillDialogWindowController;
17 @class AutofillNotificationContainer;
18 @class AutofillSectionContainer;
19 @class AutofillTooltipController;
20 @class GTMWidthBasedTweaker;
21 @class HyperlinkTextView;
23 namespace autofill {
24 class AutofillDialogViewDelegate;
27 // NSViewController for the main portion of the autofill dialog. Contains
28 // account chooser, details for current payment instruments, OK/Cancel.
29 // Might dynamically add and remove other elements.
30 @interface AutofillMainContainer : NSViewController<AutofillLayout,
31 NSTextViewDelegate> {
32 @private
33 base::scoped_nsobject<GTMWidthBasedTweaker> buttonContainer_;
34 base::scoped_nsobject<NSButton> saveInChromeCheckbox_;
35 base::scoped_nsobject<AutofillTooltipController> saveInChromeTooltip_;
36 base::scoped_nsobject<AutofillDetailsContainer> detailsContainer_;
37 base::scoped_nsobject<AutofillNotificationContainer> notificationContainer_;
38 AutofillDialogWindowController* target_;
40 // Weak. Owns the dialog.
41 autofill::AutofillDialogViewDelegate* delegate_;
44 @property(assign, nonatomic) AutofillDialogWindowController* target;
46 // Designated initializer.
47 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
49 // Returns the preferred size for the footer and notifications at the specfied
50 // |width|.
51 - (NSSize)decorationSizeForWidth:(CGFloat)width;
53 // Returns the view delegate responsible for |section|.
54 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section;
56 // Called when the delegate-maintained suggestions model has changed.
57 - (void)modelChanged;
59 // Get status of "Save in Chrome" checkbox.
60 - (BOOL)saveDetailsLocally;
62 // Called when there are changes to the notification area.
63 - (void)updateNotificationArea;
65 // Called when the error bubble needs to be updated.
66 - (void)updateErrorBubble;
68 // Validates form input data.
69 - (BOOL)validate;
71 // Updates status of "save in Chrome" checkbox.
72 - (void)updateSaveInChrome;
74 // Makes the first invalid input first responder.
75 - (void)makeFirstInvalidInputFirstResponder;
77 // Called when the main container becomes visible. Ensures the right input field
78 // becomes first responder, and positions the scrollview correctly. This MUST be
79 // called after layout on the main container is complete, since it depends on
80 // the size of the contained views to be correct.
81 - (void)scrollInitialEditorIntoViewAndMakeFirstResponder;
83 @end
86 // AutofillMainContainer helper functions, for testing purposes only.
87 @interface AutofillMainContainer (Testing)
89 @property(readonly, nonatomic) NSButton* saveInChromeCheckboxForTesting;
90 @property(readonly, nonatomic) NSImageView* saveInChromeTooltipForTesting;
92 @end
94 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_