- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / autofill / autofill_main_container.h
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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_
7
8 #import <Cocoa/Cocoa.h>
9
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
14 @class AutofillDetailsContainer;
15 @class AutofillDialogWindowController;
16 @class AutofillNotificationContainer;
17 @class AutofillSectionContainer;
18 @class GTMWidthBasedTweaker;
19 @class HyperlinkTextView;
20
21 namespace autofill {
22   class AutofillDialogViewDelegate;
23 }
24
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,
29                                                     NSTextViewDelegate> {
30  @private
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_;
39
40   // Weak. Owns the dialog.
41   autofill::AutofillDialogViewDelegate* delegate_;
42
43   // Preferred size for legal documents.
44   NSSize legalDocumentsSize_;
45
46   // Dirty marker for preferred size.
47   BOOL legalDocumentsSizeDirty_;
48 }
49
50 @property(assign, nonatomic) AutofillDialogWindowController* target;
51
52 // Designated initializer.
53 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate;
54
55 // Sets the anchor point for the notificationView_.
56 - (void)setAnchorView:(NSView*)anchorView;
57
58 // Returns the view delegate responsible for |section|.
59 - (AutofillSectionContainer*)sectionForId:(autofill::DialogSection)section;
60
61 // Called when the delegate-maintained suggestions model has changed.
62 - (void)modelChanged;
63
64 // Get status of "Save in Chrome" checkbox.
65 - (BOOL)saveDetailsLocally;
66
67 // Called when the legal documents text might need to be refreshed.
68 - (void)updateLegalDocuments;
69
70 // Called when there are changes to the notification area.
71 - (void)updateNotificationArea;
72
73 // Called when the error bubble needs to be updated.
74 - (void)updateErrorBubble;
75
76 // Validates form input data.
77 - (BOOL)validate;
78
79 // Updates status of "save in Chrome" checkbox.
80 - (void)updateSaveInChrome;
81
82 @end
83
84
85 // AutofillMainContainer helper functions, for testing purposes only.
86 @interface AutofillMainContainer (Testing)
87
88 @property(readonly, nonatomic) NSButton* saveInChromeCheckboxForTesting;
89 @property(readonly, nonatomic) NSImageView* buttonStripImageForTesting;
90 @property(readonly, nonatomic) NSImageView* saveInChromeTooltipForTesting;
91
92 @end
93
94 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_MAIN_CONTAINER_H_