Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / autofill / autofill_dialog_window_controller.h
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.
4
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_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 AutofillHeader;
15 @class AutofillLoadingShieldController;
16 @class AutofillMainContainer;
17 @class AutofillOverlayController;
18 @class AutofillSignInContainer;
19
20 namespace content {
21 class NavigationController;
22 class WebContents;
23 }  // content
24
25 namespace autofill {
26 class AutofillDialogCocoa;
27 }  // autofill
28
29
30 // Forwarding AutofillDialogView calls.
31 @protocol AutofillDialogBridge
32
33 - (void)show;
34 - (void)hide;
35 - (void)updateNotificationArea;
36 - (void)updateAccountChooser;
37 - (void)updateButtonStrip;
38 - (void)updateSection:(autofill::DialogSection)section;
39 - (void)updateForErrors;
40 - (void)fillSection:(autofill::DialogSection)section
41            forType:(const autofill::ServerFieldType)type;
42 - (void)getInputs:(autofill::FieldValueMap*)outputs
43        forSection:(autofill::DialogSection)section;
44 - (NSString*)getCvc;
45 - (BOOL)saveDetailsLocally;
46 - (content::NavigationController*)showSignIn;
47 - (void)hideSignIn;
48 - (void)modelChanged;
49 - (void)updateErrorBubble;
50 - (void)onSignInResize:(NSSize)size;
51
52 @end
53
54
55 // Window controller for AutofillDialogView.
56 @interface AutofillDialogWindowController :
57     NSWindowController<NSWindowDelegate, AutofillLayout, AutofillDialogBridge> {
58  @private
59   content::WebContents* webContents_;  // weak.
60   autofill::AutofillDialogCocoa* dialog_;  // weak.
61
62   base::scoped_nsobject<AutofillHeader> header_;
63   base::scoped_nsobject<AutofillMainContainer> mainContainer_;
64   base::scoped_nsobject<AutofillSignInContainer> signInContainer_;
65   base::scoped_nsobject<AutofillOverlayController> overlayController_;
66   base::scoped_nsobject<AutofillLoadingShieldController>
67       loadingShieldController_;
68   base::scoped_nsobject<NSTextView> fieldEditor_;
69
70   // Signals the main container has recently become visible.
71   BOOL mainContainerBecameVisible_;
72 }
73
74 // Designated initializer. The WebContents cannot be NULL.
75 - (id)initWithWebContents:(content::WebContents*)webContents
76                    dialog:(autofill::AutofillDialogCocoa*)dialog;
77
78 // Requests a re-layout for the entire dialog. The layout will be postponed
79 // until the next cycle of the runloop.
80 - (void)requestRelayout;
81
82 // Validate data. If it is valid, notify the delegate that the user would
83 // like to use the data.
84 - (IBAction)accept:(id)sender;
85
86 // User canceled the dialog.
87 - (IBAction)cancel:(id)sender;
88
89 @end
90
91
92 // Mirrors the TestableAutofillDialogView API on the C++ side.
93 @interface AutofillDialogWindowController (TestableAutofillDialogView)
94
95 - (void)setTextContents:(NSString*)text
96                 forType:(autofill::ServerFieldType)type;
97 - (void)setTextContents:(NSString*)text
98  ofSuggestionForSection:(autofill::DialogSection)section;
99 - (void)activateFieldForType:(autofill::ServerFieldType)type;
100 - (content::WebContents*)getSignInWebContents;
101 - (BOOL)isShowingOverlay;
102
103 @end
104
105 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_DIALOG_WINDOW_CONTROLLER_H_