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"
14 @class AutofillDetailsContainer;
15 @class AutofillDialogWindowController;
16 @class AutofillNotificationContainer;
17 @class AutofillSectionContainer;
18 @class GTMWidthBasedTweaker;
19 @class HyperlinkTextView;
22 class AutofillDialogViewDelegate;
25 // NSViewController for the main portion of the autofill dialog. Contains
26 // account chooser, details for current payment instruments, OK/Cancel.
27 // Might dynamically add and remove other elements.
28 @interface AutofillMainContainer : NSViewController<AutofillLayout,
31 base::scoped_nsobject<GTMWidthBasedTweaker> buttonContainer_;
32 base::scoped_nsobject<NSImageView> buttonStripImage_;
33 base::scoped_nsobject<NSButton> saveInChromeCheckbox_;
34 base::scoped_nsobject<NSImageView> saveInChromeTooltip_;
35 base::scoped_nsobject<AutofillDetailsContainer> detailsContainer_;
36 base::scoped_nsobject<HyperlinkTextView> legalDocumentsView_;
37 base::scoped_nsobject<AutofillNotificationContainer> notificationContainer_;
38 AutofillDialogWindowController* target_;
40 // Weak. Owns the dialog.
41 autofill::AutofillDialogViewDelegate* delegate_;
43 // Preferred size for legal documents.
44 NSSize legalDocumentsSize_;
46 // Dirty marker for preferred size.
47 BOOL legalDocumentsSizeDirty_;
50 @property(assign, nonatomic) AutofillDialogWindowController* target;
52 // Designated initializer.
53 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
55 // Sets the anchor point for the notificationView_.
56 - (void)setAnchorView:(NSView*)anchorView;
58 // Returns the view delegate responsible for |section|.
59 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section;
61 // Called when the delegate-maintained suggestions model has changed.
64 // Get status of "Save in Chrome" checkbox.
65 - (BOOL)saveDetailsLocally;
67 // Called when the legal documents text might need to be refreshed.
68 - (void)updateLegalDocuments;
70 // Called when there are changes to the notification area.
71 - (void)updateNotificationArea;
73 // Called when the error bubble needs to be updated.
74 - (void)updateErrorBubble;
76 // Validates form input data.
79 // Updates status of "save in Chrome" checkbox.
80 - (void)updateSaveInChrome;
85 // AutofillMainContainer helper functions, for testing purposes only.
86 @interface AutofillMainContainer (Testing)
88 @property(readonly, nonatomic) NSButton* saveInChromeCheckboxForTesting;
89 @property(readonly, nonatomic) NSImageView* buttonStripImageForTesting;
90 @property(readonly, nonatomic) NSImageView* saveInChromeTooltipForTesting;
94 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_