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_BROWSER_PROFILE_CHOOSER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_PROFILE_CHOOSER_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
11 #include "base/memory/scoped_ptr.h"
12 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
15 class ActiveProfileObserverBridge;
17 class ProfileOAuth2TokenService;
23 // This window controller manages the bubble that displays a "menu" of profiles.
24 // It is brought open by clicking on the avatar icon in the window frame.
25 @interface ProfileChooserController : BaseBubbleController {
27 // Different views that can be displayed in the bubble.
29 PROFILE_CHOOSER_VIEW, // Shows a "fast profile switcher" view.
30 ACCOUNT_MANAGEMENT_VIEW, // Shows a list of accounts for the active user.
31 GAIA_SIGNIN_VIEW, // Shows a web view for primary sign in.
32 GAIA_ADD_ACCOUNT_VIEW // Shows a web view for adding secondary accounts.
35 // The menu that contains the data from the backend.
36 scoped_ptr<AvatarMenu> avatarMenu_;
38 // An observer to be notified when the OAuth2 tokens change or the avatar
39 // menu model updates for the active profile.
40 scoped_ptr<ActiveProfileObserverBridge> observer_;
42 // The browser that launched the bubble. Not owned.
46 BubbleViewMode viewMode_;
48 // List of the full, un-elided accounts for the active profile. The keys are
49 // generated used to tag the UI buttons, and the values are the original
50 // emails displayed by the buttons.
51 std::map<int, std::string> currentProfileAccounts_;
53 // Web contents used by the inline signin view.
54 scoped_ptr<content::WebContents> webContents_;
56 // Whether the bubble is displayed for an active guest profile.
60 - (id)initWithBrowser:(Browser*)browser anchoredAt:(NSPoint)point;
62 // Creates all the subviews of the avatar bubble for |viewToDisplay|.
63 - (void)initMenuContentsWithView:(BubbleViewMode)viewToDisplay;
65 // Returns the view currently displayed by the bubble.
66 - (BubbleViewMode)viewMode;
68 // Creates a new profile.
69 - (IBAction)addNewProfile:(id)sender;
71 // Switches to a given profile. |sender| is an ProfileChooserItemController.
72 - (IBAction)switchToProfile:(id)sender;
74 // Shows the User Manager.
75 - (IBAction)showUserManager:(id)sender;
77 // Starts a guest browser window.
78 - (IBAction)switchToGuestProfile:(id)sender;
80 // Closes all guest browser windows.
81 - (IBAction)exitGuestProfile:(id)sender;
83 // Shows the account management view.
84 - (IBAction)showAccountManagement:(id)sender;
86 // Locks the active profile.
87 - (IBAction)lockProfile:(id)sender;
89 // Shows the signin page.
90 - (IBAction)showSigninPage:(id)sender;
92 // Adds an account to the active profile.
93 - (IBAction)addAccount:(id)sender;
95 // Deletes an account from the active profile.
96 - (IBAction)removeAccount:(id)sender;
99 // Testing API /////////////////////////////////////////////////////////////////
101 @interface ProfileChooserController (ExposedForTesting)
102 - (id)initWithBrowser:(Browser*)browser anchoredAt:(NSPoint)point;
105 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_PROFILE_CHOOSER_CONTROLLER_H_