1 // Copyright 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_DIALOG_WINDOW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_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 AutofillHeader;
15 @class AutofillLoadingShieldController;
16 @class AutofillMainContainer;
17 @class AutofillOverlayController;
18 @class AutofillSignInContainer;
23 class NavigationController;
28 class AutofillDialogCocoa;
31 // Forwarding AutofillDialogView calls.
32 @protocol AutofillDialogBridge
36 - (void)updateNotificationArea;
37 - (void)updateAccountChooser;
38 - (void)updateButtonStrip;
39 - (void)updateSection:(autofill::DialogSection)section;
40 - (void)updateForErrors;
41 - (void)fillSection:(autofill::DialogSection)section
42 forType:(const autofill::ServerFieldType)type;
43 - (void)getInputs:(autofill::FieldValueMap*)outputs
44 forSection:(autofill::DialogSection)section;
46 - (BOOL)saveDetailsLocally;
47 - (content::NavigationController*)showSignIn:(const GURL&)url;
50 - (void)updateErrorBubble;
51 - (void)onSignInResize:(NSSize)size;
52 - (void)validateSection:(autofill::DialogSection)section;
57 // Window controller for AutofillDialogView.
58 @interface AutofillDialogWindowController :
59 NSWindowController<NSWindowDelegate, AutofillLayout, AutofillDialogBridge> {
61 content::WebContents* webContents_; // weak.
62 autofill::AutofillDialogCocoa* dialog_; // weak.
64 base::scoped_nsobject<AutofillHeader> header_;
65 base::scoped_nsobject<AutofillMainContainer> mainContainer_;
66 base::scoped_nsobject<AutofillSignInContainer> signInContainer_;
67 base::scoped_nsobject<AutofillOverlayController> overlayController_;
68 base::scoped_nsobject<AutofillLoadingShieldController>
69 loadingShieldController_;
70 base::scoped_nsobject<NSTextView> fieldEditor_;
72 // Signals the main container has recently become visible.
73 BOOL mainContainerBecameVisible_;
76 // Designated initializer. The WebContents cannot be NULL.
77 - (id)initWithWebContents:(content::WebContents*)webContents
78 dialog:(autofill::AutofillDialogCocoa*)dialog;
80 // Requests a re-layout for the entire dialog. The layout will be postponed
81 // until the next cycle of the runloop.
82 - (void)requestRelayout;
84 // Validate data. If it is valid, notify the delegate that the user would
85 // like to use the data.
86 - (IBAction)accept:(id)sender;
88 // User canceled the dialog.
89 - (IBAction)cancel:(id)sender;
94 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_H_