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

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

Issue 944563002: Fix fast user switcher appearance when empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 NSMaxY([anchor bounds]) - kMenuYOffsetAdjust); 180 NSMaxY([anchor bounds]) - kMenuYOffsetAdjust);
181 point = [anchor convertPoint:point toView:nil]; 181 point = [anchor convertPoint:point toView:nil];
182 point = [[anchor window] convertBaseToScreen:point]; 182 point = [[anchor window] convertBaseToScreen:point];
183 183
184 // |menuController_| will automatically release itself on close. 184 // |menuController_| will automatically release itself on close.
185 if (switches::IsNewAvatarMenu()) { 185 if (switches::IsNewAvatarMenu()) {
186 profiles::BubbleViewMode viewMode; 186 profiles::BubbleViewMode viewMode;
187 profiles::TutorialMode tutorialMode; 187 profiles::TutorialMode tutorialMode;
188 profiles::BubbleViewModeFromAvatarBubbleMode( 188 profiles::BubbleViewModeFromAvatarBubbleMode(
189 mode, &viewMode, &tutorialMode); 189 mode, &viewMode, &tutorialMode);
190 // Don't start creating the view if it would be an empty fast user switcher.
191 // This is the case when there is 0 or 1 profiles (the current one). It has
192 // to happen here to prevent the creation of an empty container.
193 if (viewMode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER &&
194 g_browser_process->profile_manager()->GetNumberOfProfiles() <= 1) {
195 return;
196 }
197
190 menuController_ = 198 menuController_ =
191 [[ProfileChooserController alloc] initWithBrowser:browser_ 199 [[ProfileChooserController alloc] initWithBrowser:browser_
192 anchoredAt:point 200 anchoredAt:point
193 viewMode:viewMode 201 viewMode:viewMode
194 tutorialMode:tutorialMode 202 tutorialMode:tutorialMode
195 serviceType:serviceType]; 203 serviceType:serviceType];
196 } else { 204 } else {
197 menuController_ = 205 menuController_ =
198 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_ 206 [[AvatarMenuBubbleController alloc] initWithBrowser:browser_
199 anchoredAt:point]; 207 anchoredAt:point];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 244 }
237 245
238 - (void)updateErrorStatus:(BOOL)hasError { 246 - (void)updateErrorStatus:(BOOL)hasError {
239 } 247 }
240 248
241 - (BaseBubbleController*)menuController { 249 - (BaseBubbleController*)menuController {
242 return menuController_; 250 return menuController_;
243 } 251 }
244 252
245 @end 253 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698