Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h

Issue 297803007: Move profile_chooser enums to a constant place for mac and win. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit tests need love too Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/ui/profile_chooser_constants.h"
13 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" 14 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
14 15
15 class AvatarMenu; 16 class AvatarMenu;
16 class ActiveProfileObserverBridge; 17 class ActiveProfileObserverBridge;
17 class Browser; 18 class Browser;
18 class ProfileOAuth2TokenService; 19 class ProfileOAuth2TokenService;
19 20
20 namespace content { 21 namespace content {
21 class WebContents; 22 class WebContents;
22 } 23 }
23 24
24 // This window controller manages the bubble that displays a "menu" of profiles. 25 // 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 // It is brought open by clicking on the avatar icon in the window frame.
26 @interface ProfileChooserController : BaseBubbleController<NSTextViewDelegate> { 27 @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
42 };
43
44 @private 28 @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.
50 };
51
52 // The menu that contains the data from the backend. 29 // The menu that contains the data from the backend.
53 scoped_ptr<AvatarMenu> avatarMenu_; 30 scoped_ptr<AvatarMenu> avatarMenu_;
54 31
55 // An observer to be notified when the OAuth2 tokens change or the avatar 32 // An observer to be notified when the OAuth2 tokens change or the avatar
56 // menu model updates for the active profile. 33 // menu model updates for the active profile.
57 scoped_ptr<ActiveProfileObserverBridge> observer_; 34 scoped_ptr<ActiveProfileObserverBridge> observer_;
58 35
59 // The browser that launched the bubble. Not owned. 36 // The browser that launched the bubble. Not owned.
60 Browser* browser_; 37 Browser* browser_;
61 38
62 // The id for the account that the user has requested to remove from the 39 // 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 40 // current profile. It is set in |showAccountRemovalView| and used in
64 // |removeAccount|. 41 // |removeAccount|.
65 std::string accountIdToRemove_; 42 std::string accountIdToRemove_;
66 43
67 // Active view mode. 44 // Active view mode.
68 BubbleViewMode viewMode_; 45 profiles::BubbleViewMode viewMode_;
69 46
70 // The current tutorial mode. 47 // The current tutorial mode.
71 TutorialMode tutorialMode_; 48 profiles::TutorialMode tutorialMode_;
72 49
73 // List of the full, un-elided accounts for the active profile. The keys are 50 // 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 51 // generated used to tag the UI buttons, and the values are the original
75 // emails displayed by the buttons. 52 // emails displayed by the buttons.
76 std::map<int, std::string> currentProfileAccounts_; 53 std::map<int, std::string> currentProfileAccounts_;
77 54
78 // Web contents used by the inline signin view. 55 // Web contents used by the inline signin view.
79 scoped_ptr<content::WebContents> webContents_; 56 scoped_ptr<content::WebContents> webContents_;
80 57
81 // Whether the bubble is displayed for an active guest profile. 58 // Whether the bubble is displayed for an active guest profile.
82 BOOL isGuestSession_; 59 BOOL isGuestSession_;
83 } 60 }
84 61
85 - (id)initWithBrowser:(Browser*)browser 62 - (id)initWithBrowser:(Browser*)browser
86 anchoredAt:(NSPoint)point 63 anchoredAt:(NSPoint)point
87 withMode:(BubbleViewMode)mode; 64 withMode:(profiles::BubbleViewMode)mode;
88 65
89 // Creates all the subviews of the avatar bubble for |viewToDisplay|. 66 // Creates all the subviews of the avatar bubble for |viewToDisplay|.
90 - (void)initMenuContentsWithView:(BubbleViewMode)viewToDisplay; 67 - (void)initMenuContentsWithView:(profiles::BubbleViewMode)viewToDisplay;
91 68
92 // Returns the view currently displayed by the bubble. 69 // Returns the view currently displayed by the bubble.
93 - (BubbleViewMode)viewMode; 70 - (profiles::BubbleViewMode)viewMode;
94 71
95 // Switches to a given profile. |sender| is an ProfileChooserItemController. 72 // Switches to a given profile. |sender| is an ProfileChooserItemController.
96 - (IBAction)switchToProfile:(id)sender; 73 - (IBAction)switchToProfile:(id)sender;
97 74
98 // Shows the User Manager. 75 // Shows the User Manager.
99 - (IBAction)showUserManager:(id)sender; 76 - (IBAction)showUserManager:(id)sender;
100 77
101 // Closes all guest browsers and shows the User Manager. 78 // Closes all guest browsers and shows the User Manager.
102 - (IBAction)exitGuest:(id)sender; 79 - (IBAction)exitGuest:(id)sender;
103 80
(...skipping 24 matching lines...) Expand all
128 105
129 // Reset the WebContents used by the Gaia embedded view. 106 // Reset the WebContents used by the Gaia embedded view.
130 - (void)cleanUpEmbeddedViewContents; 107 - (void)cleanUpEmbeddedViewContents;
131 @end 108 @end
132 109
133 // Testing API ///////////////////////////////////////////////////////////////// 110 // Testing API /////////////////////////////////////////////////////////////////
134 111
135 @interface ProfileChooserController (ExposedForTesting) 112 @interface ProfileChooserController (ExposedForTesting)
136 - (id)initWithBrowser:(Browser*)browser 113 - (id)initWithBrowser:(Browser*)browser
137 anchoredAt:(NSPoint)point 114 anchoredAt:(NSPoint)point
138 withMode:(BubbleViewMode)mode; 115 withMode:(profiles::BubbleViewMode)mode;
139 @end 116 @end
140 117
141 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_ 118 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_PROFILE_CHOOSER_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698