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 AutofillTooltipController
;
19 @
class GTMWidthBasedTweaker
;
20 @
class HyperlinkTextView
;
23 class AutofillDialogViewDelegate
;
26 // NSViewController for the main portion of the autofill dialog. Contains
27 // account chooser, details for current payment instruments, OK/Cancel.
28 // Might dynamically add and remove other elements.
29 @interface AutofillMainContainer
: NSViewController
<AutofillLayout
,
32 base::scoped_nsobject
<GTMWidthBasedTweaker
> buttonContainer_
;
33 base::scoped_nsobject
<NSImageView
> buttonStripImage_
;
34 base::scoped_nsobject
<NSButton
> saveInChromeCheckbox_
;
35 base::scoped_nsobject
<AutofillTooltipController
> saveInChromeTooltip_
;
36 base::scoped_nsobject
<AutofillDetailsContainer
> detailsContainer_
;
37 base::scoped_nsobject
<HyperlinkTextView
> legalDocumentsView_
;
38 base::scoped_nsobject
<AutofillNotificationContainer
> notificationContainer_
;
39 AutofillDialogWindowController
* target_
;
41 // Weak. Owns the dialog.
42 autofill::AutofillDialogViewDelegate
* delegate_
;
44 // Preferred size for legal documents.
45 NSSize legalDocumentsSize_
;
47 // Dirty marker for preferred size.
48 BOOL legalDocumentsSizeDirty_
;
51 @
property(assign
, nonatomic
) AutofillDialogWindowController
* target
;
53 // Designated initializer.
54 - (id
)initWithDelegate
:(autofill::AutofillDialogViewDelegate
*)delegate
;
56 // Returns the preferred size for the footer and notifications at the specfied
58 - (NSSize
)decorationSizeForWidth
:(CGFloat
)width
;
60 // Sets the anchor point for the notificationView_.
61 - (void)setAnchorView
:(NSView
*)anchorView
;
63 // Returns the view delegate responsible for |section|.
64 - (AutofillSectionContainer
*)sectionForId
:(autofill::DialogSection
)section
;
66 // Called when the delegate-maintained suggestions model has changed.
69 // Get status of "Save in Chrome" checkbox.
70 - (BOOL
)saveDetailsLocally
;
72 // Called when the legal documents text might need to be refreshed.
73 - (void)updateLegalDocuments
;
75 // Called when there are changes to the notification area.
76 - (void)updateNotificationArea
;
78 // Called when the error bubble needs to be updated.
79 - (void)updateErrorBubble
;
81 // Validates form input data.
84 // Updates status of "save in Chrome" checkbox.
85 - (void)updateSaveInChrome
;
87 // Makes the first invalid input first responder.
88 - (void)makeFirstInvalidInputFirstResponder
;
90 // Called when the main container becomes visible. Ensures the right input field
91 // becomes first responder, and positions the scrollview correctly. This MUST be
92 // called after layout on the main container is complete, since it depends on
93 // the size of the contained views to be correct.
94 - (void)scrollInitialEditorIntoViewAndMakeFirstResponder
;
99 // AutofillMainContainer helper functions, for testing purposes only.
100 @interface
AutofillMainContainer (Testing
)
102 @
property(readonly
, nonatomic
) NSButton
* saveInChromeCheckboxForTesting
;
103 @
property(readonly
, nonatomic
) NSImageView
* buttonStripImageForTesting
;
104 @
property(readonly
, nonatomic
) NSImageView
* saveInChromeTooltipForTesting
;
108 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_