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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm

Issue 869793004: Bring up the Fast User Switcher on Shift+Click on the new Avatar Button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix browser tests Created 5 years, 10 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 #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 "base/mac/foundation_util.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile_info_cache_observer.h" 10 #include "chrome/browser/profiles/profile_info_cache_observer.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 addObserver:self 203 addObserver:self
204 selector:@selector(bubbleWillClose:) 204 selector:@selector(bubbleWillClose:)
205 name:NSWindowWillCloseNotification 205 name:NSWindowWillCloseNotification
206 object:[menuController_ window]]; 206 object:[menuController_ window]];
207 [menuController_ showWindow:self]; 207 [menuController_ showWindow:self];
208 208
209 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE); 209 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ICON_AVATAR_BUBBLE);
210 } 210 }
211 211
212 - (IBAction)buttonClicked:(id)sender { 212 - (IBAction)buttonClicked:(id)sender {
213 BrowserWindow::AvatarBubbleMode mode =
214 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT;
215
216 if([NSEvent modifierFlags] & NSCommandKeyMask)
Alexei Svitkine (slow) 2015/02/02 17:22:30 Nit: space after if
anthonyvd 2015/02/03 21:53:20 Done.
217 mode = BrowserWindow::AVATAR_BUBBLE_MODE_FAST_USER_SWITCH;
218
213 [self showAvatarBubbleAnchoredAt:button_ 219 [self showAvatarBubbleAnchoredAt:button_
214 withMode:BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT 220 withMode:mode
215 withServiceType:signin::GAIA_SERVICE_TYPE_NONE]; 221 withServiceType:signin::GAIA_SERVICE_TYPE_NONE];
216 } 222 }
217 223
218 - (void)bubbleWillClose:(NSNotification*)notif { 224 - (void)bubbleWillClose:(NSNotification*)notif {
219 NSWindowController* wc = 225 NSWindowController* wc =
220 [browser_->window()->GetNativeWindow() windowController]; 226 [browser_->window()->GetNativeWindow() windowController];
221 if ([wc isKindOfClass:[BrowserWindowController class]]) { 227 if ([wc isKindOfClass:[BrowserWindowController class]]) {
222 [static_cast<BrowserWindowController*>(wc) 228 [static_cast<BrowserWindowController*>(wc)
223 releaseBarVisibilityForOwner:self withAnimation:YES delay:NO]; 229 releaseBarVisibilityForOwner:self withAnimation:YES delay:NO];
224 } 230 }
225 menuController_ = nil; 231 menuController_ = nil;
226 } 232 }
227 233
228 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent { 234 - (void)updateAvatarButtonAndLayoutParent:(BOOL)layoutParent {
229 NOTREACHED(); 235 NOTREACHED();
230 } 236 }
231 237
232 - (void)updateErrorStatus:(BOOL)hasError { 238 - (void)updateErrorStatus:(BOOL)hasError {
233 } 239 }
234 240
235 - (BaseBubbleController*)menuController { 241 - (BaseBubbleController*)menuController {
236 return menuController_; 242 return menuController_;
237 } 243 }
238 244
239 @end 245 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698