Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / one_click_signin_view_controller.h
blob9e293c1b221117a52931601601b7eecbc1620e80
1 // Copyright (c) 2012 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_ONE_CLICK_SIGNIN_VIEW_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_ONE_CLICK_SIGNIN_VIEW_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/callback.h"
11 #include "base/mac/scoped_nsobject.h"
12 #include "chrome/browser/ui/browser_window.h"
14 @class BrowserWindowController;
15 namespace content {
16 class WebContents;
18 @class HyperlinkTextView;
20 // View controller for the one-click signin confirmation UI.
21 @interface OneClickSigninViewController : NSViewController<NSTextViewDelegate> {
22 @private
23 IBOutlet NSTextField* messageTextField_;
24 IBOutlet NSTextField* titleTextField_;
25 IBOutlet NSTextField* informativePlaceholderTextField_;
26 IBOutlet NSButton* advancedLink_;
27 IBOutlet NSButton* closeButton_;
29 // This is YES if this is the modal sync confirmation dialog.
30 BOOL isSyncDialog_;
32 // This is YES if the user clicked the Learn More link before another action.
33 BOOL clickedLearnMore_;
35 // The user's email address to be used for sync.
36 base::string16 email_;
38 // Alternate error message to be displayed.
39 base::scoped_nsobject<NSString> errorMessage_;
41 // Text fields don't work as well with embedded links as text views, but
42 // text views cannot conveniently be created in IB. The xib file contains
43 // a text field |informativePlaceholderTextField_| that's replaced by this
44 // text view |promo_| in -awakeFromNib.
45 base::scoped_nsobject<HyperlinkTextView> informativeTextView_;
46 BrowserWindow::StartSyncCallback startSyncCallback_;
47 base::Closure closeCallback_;
48 content::WebContents* webContents_;
51 // Initializes the controller from a nib file, with an alternate |errorMessage|
52 // that can be displayed in the case of an authentication error.
53 // |syncCallback| is called to start sync for the given |email|, if
54 // |isSyncDialog| is YES. |webContents| is used to open the Learn More and
55 // Advanced links and |callback| is called when the view is closing.
56 - (id)initWithNibName:(NSString*)nibName
57 webContents:(content::WebContents*)webContents
58 syncCallback:(const BrowserWindow::StartSyncCallback&)syncCallback
59 closeCallback:(const base::Closure&)callback
60 isSyncDialog:(BOOL)isSyncDialog
61 email:(const base::string16&)email
62 errorMessage:(NSString*)errorMessage;
64 // Called before the view is closed.
65 - (void)viewWillClose;
67 // Starts sync and closes the bubble.
68 - (IBAction)ok:(id)sender;
70 // Starts sync and closes the bubble.
71 - (IBAction)onClickClose:(id)sender;
73 // Does not start sync and closes the bubble.
74 - (IBAction)onClickUndo:(id)sender;
76 // Calls |advancedCallback_|.
77 - (IBAction)onClickAdvancedLink:(id)sender;
79 @end
81 #endif // CHROME_BROWSER_UI_COCOA_ONE_CLICK_SIGNIN_VIEW_CONTROLLER_H_