OLD | NEW |
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 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_base_controller.h" |
6 | 6 |
| 7 #include "base/mac/foundation_util.h" |
7 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 10 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 11 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/browser/profiles/profile_metrics.h" | 13 #include "chrome/browser/profiles/profile_metrics.h" |
13 #include "chrome/browser/signin/signin_header_helper.h" | 14 #include "chrome/browser/signin/signin_header_helper.h" |
14 #include "chrome/browser/profiles/profiles_state.h" | 15 #include "chrome/browser/profiles/profiles_state.h" |
15 #include "chrome/browser/profiles/profile_window.h" | 16 #include "chrome/browser/profiles/profile_window.h" |
16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 135 } |
135 | 136 |
136 - (NSButton*)buttonView { | 137 - (NSButton*)buttonView { |
137 CHECK(button_.get()); // Subclasses must set this. | 138 CHECK(button_.get()); // Subclasses must set this. |
138 return button_.get(); | 139 return button_.get(); |
139 } | 140 } |
140 | 141 |
141 - (void)showAvatarBubble:(NSView*)anchor | 142 - (void)showAvatarBubble:(NSView*)anchor |
142 withMode:(BrowserWindow::AvatarBubbleMode)mode | 143 withMode:(BrowserWindow::AvatarBubbleMode)mode |
143 withServiceType:(signin::GAIAServiceType)serviceType { | 144 withServiceType:(signin::GAIAServiceType)serviceType { |
144 if (menuController_) | 145 if (menuController_) { |
| 146 if (switches::IsNewAvatarMenu()) { |
| 147 profiles::BubbleViewMode viewMode; |
| 148 profiles::TutorialMode tutorialMode; |
| 149 profiles::BubbleViewModeFromAvatarBubbleMode( |
| 150 mode, &viewMode, &tutorialMode); |
| 151 if (tutorialMode != profiles::TUTORIAL_MODE_NONE) { |
| 152 ProfileChooserController* profileChooserController = |
| 153 base::mac::ObjCCastStrict<ProfileChooserController>( |
| 154 menuController_); |
| 155 [profileChooserController setTutorialMode:tutorialMode]; |
| 156 [profileChooserController initMenuContentsWithView:viewMode]; |
| 157 } |
| 158 } |
145 return; | 159 return; |
| 160 } |
146 | 161 |
147 DCHECK(chrome::IsCommandEnabled(browser_, IDC_SHOW_AVATAR_MENU)); | 162 DCHECK(chrome::IsCommandEnabled(browser_, IDC_SHOW_AVATAR_MENU)); |
148 | 163 |
149 NSWindowController* wc = | 164 NSWindowController* wc = |
150 [browser_->window()->GetNativeWindow() windowController]; | 165 [browser_->window()->GetNativeWindow() windowController]; |
151 if ([wc isKindOfClass:[BrowserWindowController class]]) { | 166 if ([wc isKindOfClass:[BrowserWindowController class]]) { |
152 [static_cast<BrowserWindowController*>(wc) | 167 [static_cast<BrowserWindowController*>(wc) |
153 lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; | 168 lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; |
154 } | 169 } |
155 | 170 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 228 } |
214 | 229 |
215 - (void)updateErrorStatus:(BOOL)hasError { | 230 - (void)updateErrorStatus:(BOOL)hasError { |
216 } | 231 } |
217 | 232 |
218 - (BaseBubbleController*)menuController { | 233 - (BaseBubbleController*)menuController { |
219 return menuController_; | 234 return menuController_; |
220 } | 235 } |
221 | 236 |
222 @end | 237 @end |
OLD | NEW |