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

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

Issue 2034093003: Added flags for previous code change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More unittest fix Created 4 years, 6 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/profile_chooser_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
6 6
7 #import <Carbon/Carbon.h> // kVK_Return. 7 #import <Carbon/Carbon.h> // kVK_Return.
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1027 }
1028 1028
1029 - (IBAction)exitGuest:(id)sender { 1029 - (IBAction)exitGuest:(id)sender {
1030 DCHECK(browser_->profile()->IsGuestSession()); 1030 DCHECK(browser_->profile()->IsGuestSession());
1031 UserManager::Show(base::FilePath(), 1031 UserManager::Show(base::FilePath(),
1032 profiles::USER_MANAGER_NO_TUTORIAL, 1032 profiles::USER_MANAGER_NO_TUTORIAL,
1033 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION); 1033 profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
1034 profiles::CloseGuestProfileWindows(); 1034 profiles::CloseGuestProfileWindows();
1035 } 1035 }
1036 1036
1037 - (IBAction)goIncognito:(id)sender {
1038 DCHECK([self shouldShowGoIncognito]);
1039 chrome::NewIncognitoWindow(browser_);
1040 [self postActionPerformed:
1041 ProfileMetrics::PROFILE_DESKTOP_MENU_GO_INCOGNITO];
1042 }
1043
1037 - (IBAction)showAccountManagement:(id)sender { 1044 - (IBAction)showAccountManagement:(id)sender {
1038 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; 1045 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT];
1039 } 1046 }
1040 1047
1041 - (IBAction)hideAccountManagement:(id)sender { 1048 - (IBAction)hideAccountManagement:(id)sender {
1042 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]; 1049 [self initMenuContentsWithView:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER];
1043 } 1050 }
1044 1051
1045 - (IBAction)lockProfile:(id)sender { 1052 - (IBAction)lockProfile:(id)sender {
1046 profiles::LockProfile(browser_->profile()); 1053 profiles::LockProfile(browser_->profile());
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 imageResourceId:IDR_ICON_PROFILES_MENU_LOCK 1961 imageResourceId:IDR_ICON_PROFILES_MENU_LOCK
1955 action:@selector(lockProfile:)]; 1962 action:@selector(lockProfile:)];
1956 [container addSubview:lockButton]; 1963 [container addSubview:lockButton];
1957 viewRect.origin.y = NSMaxY([lockButton frame]); 1964 viewRect.origin.y = NSMaxY([lockButton frame]);
1958 1965
1959 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect]; 1966 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect];
1960 [container addSubview:separator]; 1967 [container addSubview:separator];
1961 viewRect.origin.y = NSMaxY([separator frame]); 1968 viewRect.origin.y = NSMaxY([separator frame]);
1962 } 1969 }
1963 1970
1971 if (!switches::IsMaterialDesignUserMenu() && [self shouldShowGoIncognito]) {
1972 NSButton* goIncognitoButton =
1973 [self hoverButtonWithRect:viewRect
1974 text:l10n_util::GetNSString(
1975 IDS_PROFILES_GO_INCOGNITO_BUTTON)
1976 imageResourceId:IDR_ICON_PROFILES_MENU_INCOGNITO
1977 action:@selector(goIncognito:)];
1978 viewRect.origin.y = NSMaxY([goIncognitoButton frame]);
1979 [container addSubview:goIncognitoButton];
1980
1981 NSBox* separator = [self horizontalSeparatorWithFrame:viewRect];
1982 [container addSubview:separator];
1983 viewRect.origin.y = NSMaxY([separator frame]);
1984 }
1985
1964 NSString* text = isGuestSession_ ? 1986 NSString* text = isGuestSession_ ?
1965 l10n_util::GetNSString(IDS_PROFILES_EXIT_GUEST) : 1987 l10n_util::GetNSString(IDS_PROFILES_EXIT_GUEST) :
1966 l10n_util::GetNSString(IDS_PROFILES_MANAGE_USERS_BUTTON); 1988 l10n_util::GetNSString(IDS_PROFILES_SWITCH_USERS_BUTTON);
1989 if (!isGuestSession_ && switches::IsMaterialDesignUserMenu()) {
1990 text = l10n_util::GetNSString(IDS_PROFILES_MANAGE_USERS_BUTTON);
1991 }
1967 NSButton* switchUsersButton = 1992 NSButton* switchUsersButton =
1968 [self hoverButtonWithRect:viewRect 1993 [self hoverButtonWithRect:viewRect
1969 text:text 1994 text:text
1970 imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR 1995 imageResourceId:IDR_ICON_PROFILES_MENU_AVATAR
1971 action:isGuestSession_? @selector(exitGuest:) : 1996 action:isGuestSession_? @selector(exitGuest:) :
1972 @selector(showUserManager:)]; 1997 @selector(showUserManager:)];
1973 viewRect.origin.y = NSMaxY([switchUsersButton frame]); 1998 viewRect.origin.y = NSMaxY([switchUsersButton frame]);
1974 [container addSubview:switchUsersButton]; 1999 [container addSubview:switchUsersButton];
1975 2000
1976 [container setFrameSize:NSMakeSize(rect.size.width, viewRect.origin.y)]; 2001 [container setFrameSize:NSMakeSize(rect.size.width, viewRect.origin.y)];
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 } 2400 }
2376 2401
2377 - (bool)shouldShowGoIncognito { 2402 - (bool)shouldShowGoIncognito {
2378 bool incognitoAvailable = 2403 bool incognitoAvailable =
2379 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2404 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2380 IncognitoModePrefs::DISABLED; 2405 IncognitoModePrefs::DISABLED;
2381 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2406 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2382 } 2407 }
2383 2408
2384 @end 2409 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698