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_PROFILE_SIGNIN_CONFIRMATION_VIEW_CONTROLLER_ 6 #define CHROME_BROWSER_UI_COCOA_PROFILE_SIGNIN_CONFIRMATION_VIEW_CONTROLLER_ 7 8 #import <Cocoa/Cocoa.h> 9 #include <string> 10 11 #include "base/callback.h" 12 #include "base/mac/scoped_nsobject.h" 13 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" 14 15 @class HyperlinkTextView; 16 class Browser; 17 class Profile; 18 19 namespace ui { 20 class ProfileSigninConfirmationDelegate; 21 } 22 23 @interface ProfileSigninConfirmationViewController 24 : NSViewController<NSTextViewDelegate> { 25 @private 26 // The browser object for the sign-in tab. 27 Browser* browser_; 28 29 // The GAIA username being signed in. 30 std::string username_; 31 32 // Indicates whether the user should be given the option to 33 // create a new profile before completing sign-in. 34 bool offerProfileCreation_; 35 36 // Dialog button callbacks. 37 ui::ProfileSigninConfirmationDelegate* delegate_; 38 base::Closure closeDialogCallback_; 39 40 // UI elements. 41 base::scoped_nsobject<NSBox> promptBox_; 42 base::scoped_nsobject<NSButton> closeButton_; 43 base::scoped_nsobject<NSTextField> titleField_; 44 base::scoped_nsobject<NSTextField> promptField_; 45 base::scoped_nsobject<NSTextView> explanationField_; 46 base::scoped_nsobject<ConstrainedWindowButton> createProfileButton_; 47 base::scoped_nsobject<ConstrainedWindowButton> cancelButton_; 48 base::scoped_nsobject<ConstrainedWindowButton> okButton_; 49 } 50 51 - (id)initWithBrowser:(Browser*)browser 52 username:(const std::string&)username 53 delegate:(ui::ProfileSigninConfirmationDelegate*)delegate 54 closeDialogCallback:(const base::Closure&)closeDialogCallback 55 offerProfileCreation:(bool)offer; 56 - (IBAction)cancel:(id)sender; 57 - (IBAction)ok:(id)sender; 58 - (IBAction)close:(id)sender; 59 - (IBAction)createProfile:(id)sender; 60 61 @end 62 63 @interface ProfileSigninConfirmationViewController (TestingAPI) 64 65 @property(readonly, nonatomic) ui::ProfileSigninConfirmationDelegate* delegate; 66 @property(readonly, nonatomic) NSButton* createProfileButton; 67 @property(readonly, nonatomic) NSTextView* explanationField; 68 69 @end 70 71 #endif // CHROME_BROWSER_UI_COCOA_PROFILE_SIGNIN_CONFIRMATION_VIEW_CONTROLLER_ 72