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"
13 #include "components/autofill/core/browser/dialog_section.h"
15 @
class AutofillHeader
;
16 @
class AutofillMainContainer
;
21 class NavigationController
;
26 class AutofillDialogCocoa
;
29 // Forwarding AutofillDialogView calls.
30 @protocol AutofillDialogBridge
34 - (void)updateNotificationArea
;
35 - (void)updateSection
:(autofill::DialogSection
)section
;
36 - (void)updateForErrors
;
37 - (void)fillSection
:(autofill::DialogSection
)section
38 forType
:(const autofill::ServerFieldType
)type
;
39 - (void)getInputs
:(autofill::FieldValueMap
*)outputs
40 forSection
:(autofill::DialogSection
)section
;
42 - (BOOL
)saveDetailsLocally
;
44 - (void)updateErrorBubble
;
45 - (void)validateSection
:(autofill::DialogSection
)section
;
50 // Window controller for AutofillDialogView.
51 @interface AutofillDialogWindowController
:
52 NSWindowController
<NSWindowDelegate
, AutofillLayout
, AutofillDialogBridge
> {
54 content::WebContents
* webContents_
; // weak.
55 autofill::AutofillDialogCocoa
* dialog_
; // weak.
57 base::scoped_nsobject
<AutofillHeader
> header_
;
58 base::scoped_nsobject
<AutofillMainContainer
> mainContainer_
;
59 base::scoped_nsobject
<NSTextView
> fieldEditor_
;
61 // Signals the main container has recently become visible.
62 BOOL mainContainerBecameVisible_
;
65 // Designated initializer. The WebContents cannot be NULL.
66 - (id
)initWithWebContents
:(content::WebContents
*)webContents
67 dialog
:(autofill::AutofillDialogCocoa
*)dialog
;
69 // Requests a re-layout for the entire dialog. The layout will be postponed
70 // until the next cycle of the runloop.
71 - (void)requestRelayout
;
73 // Validate data. If it is valid, notify the delegate that the user would
74 // like to use the data.
75 - (IBAction
)accept
:(id
)sender
;
77 // User canceled the dialog.
78 - (IBAction
)cancel
:(id
)sender
;
83 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_H_