[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / profiles / profile_chooser_controller.h
blob453573afb569d9227ac9e746e2bc0a300f2f9946
1 // Copyright 2014 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_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
9 #include <map>
10 #include <string>
12 #include "base/memory/scoped_ptr.h"
13 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
15 class AvatarMenu;
16 class ActiveProfileObserverBridge;
17 class Browser;
18 class ProfileOAuth2TokenService;
20 namespace content {
21 class WebContents;
24 // This window controller manages the bubble that displays a "menu" of profiles.
25 // It is brought open by clicking on the avatar icon in the window frame.
26 @interface ProfileChooserController : BaseBubbleController<NSTextViewDelegate> {
27 @public
28 // Different views that can be displayed in the bubble.
29 enum BubbleViewMode {
30 // Shows a "fast profile switcher" view.
31 BUBBLE_VIEW_MODE_PROFILE_CHOOSER,
32 // Shows a list of accounts for the active user.
33 BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT,
34 // Shows a web view for primary sign in.
35 BUBBLE_VIEW_MODE_GAIA_SIGNIN,
36 // Shows a web view for adding secondary accounts.
37 BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT,
38 // Shows a view for confirming account removal.
39 BUBBLE_VIEW_MODE_ACCOUNT_REMOVAL,
40 // Shows a view for ending new profile management preview.
41 BUBBLE_VIEW_MODE_END_PREVIEW
44 @private
45 enum TutorialMode {
46 TUTORIAL_MODE_NONE, // No tutorial card shown.
47 TUTORIAL_MODE_ENABLE_PREVIEW, // The enable-mirror-preview tutorial shown.
48 TUTORIAL_MODE_WELCOME, // The welcome-to-mirror tutorial shown.
49 TUTORIAL_MODE_SEND_FEEDBACK // The send-feedback tutorial shown.
52 // The menu that contains the data from the backend.
53 scoped_ptr<AvatarMenu> avatarMenu_;
55 // An observer to be notified when the OAuth2 tokens change or the avatar
56 // menu model updates for the active profile.
57 scoped_ptr<ActiveProfileObserverBridge> observer_;
59 // The browser that launched the bubble. Not owned.
60 Browser* browser_;
62 // The id for the account that the user has requested to remove from the
63 // current profile. It is set in |showAccountRemovalView| and used in
64 // |removeAccount|.
65 std::string accountIdToRemove_;
67 // Active view mode.
68 BubbleViewMode viewMode_;
70 // The current tutorial mode.
71 TutorialMode tutorialMode_;
73 // List of the full, un-elided accounts for the active profile. The keys are
74 // generated used to tag the UI buttons, and the values are the original
75 // emails displayed by the buttons.
76 std::map<int, std::string> currentProfileAccounts_;
78 // Web contents used by the inline signin view.
79 scoped_ptr<content::WebContents> webContents_;
81 // Whether the bubble is displayed for an active guest profile.
82 BOOL isGuestSession_;
85 - (id)initWithBrowser:(Browser*)browser
86 anchoredAt:(NSPoint)point
87 withMode:(BubbleViewMode)mode;
89 // Creates all the subviews of the avatar bubble for |viewToDisplay|.
90 - (void)initMenuContentsWithView:(BubbleViewMode)viewToDisplay;
92 // Returns the view currently displayed by the bubble.
93 - (BubbleViewMode)viewMode;
95 // Switches to a given profile. |sender| is an ProfileChooserItemController.
96 - (IBAction)switchToProfile:(id)sender;
98 // Shows the User Manager.
99 - (IBAction)showUserManager:(id)sender;
101 // Closes all guest browsers and shows the User Manager.
102 - (IBAction)exitGuest:(id)sender;
104 // Shows the account management view.
105 - (IBAction)showAccountManagement:(id)sender;
107 // Hides the account management view and shows the default view.
108 - (IBAction)hideAccountManagement:(id)sender;
110 // Locks the active profile.
111 - (IBAction)lockProfile:(id)sender;
113 // Shows the inline signin page.
114 - (IBAction)showInlineSigninPage:(id)sender;
116 // Shows the signin tab in the browser.
117 - (IBAction)showTabbedSigninPage:(id)sender;
119 // Adds an account to the active profile.
120 - (IBAction)addAccount:(id)sender;
122 // Shows the account removal view to confirm removing the currently selected
123 // account from the active profile if possible.
124 - (IBAction)showAccountRemovalView:(id)sender;
126 // Removes the current account |accountIdToRemove_|.
127 - (IBAction)removeAccount:(id)sender;
129 // Reset the WebContents used by the Gaia embedded view.
130 - (void)cleanUpEmbeddedViewContents;
131 @end
133 // Testing API /////////////////////////////////////////////////////////////////
135 @interface ProfileChooserController (ExposedForTesting)
136 - (id)initWithBrowser:(Browser*)browser
137 anchoredAt:(NSPoint)point
138 withMode:(BubbleViewMode)mode;
139 @end
141 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_