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

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

Issue 2478523003: Show user menu on right-click of the avatar button when MaterialDesignUserMenu is enabled. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 base::scoped_nsobject<NSView> container( 1556 base::scoped_nsobject<NSView> container(
1557 [[NSView alloc] initWithFrame:NSZeroRect]); 1557 [[NSView alloc] initWithFrame:NSZeroRect]);
1558 1558
1559 NSView* tutorialView = nil; 1559 NSView* tutorialView = nil;
1560 NSView* syncErrorView = nil; 1560 NSView* syncErrorView = nil;
1561 NSView* currentProfileView = nil; 1561 NSView* currentProfileView = nil;
1562 base::scoped_nsobject<NSMutableArray> otherProfiles( 1562 base::scoped_nsobject<NSMutableArray> otherProfiles(
1563 [[NSMutableArray alloc] init]); 1563 [[NSMutableArray alloc] init]);
1564 // Local and guest profiles cannot lock their profile. 1564 // Local and guest profiles cannot lock their profile.
1565 bool showLock = false; 1565 bool showLock = false;
1566 bool isFastProfileChooser = 1566 bool isFastProfileChooser = switches::IsMaterialDesignUserMenu() ?
1567 viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; 1567 false : viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER;
1568 if (isFastProfileChooser) { 1568 if (isFastProfileChooser) {
1569 // The user is using right-click switching, no need to tell them about it. 1569 // The user is using right-click switching, no need to tell them about it.
1570 PrefService* localState = g_browser_process->local_state(); 1570 PrefService* localState = g_browser_process->local_state();
1571 localState->SetBoolean( 1571 localState->SetBoolean(
1572 prefs::kProfileAvatarRightClickTutorialDismissed, true); 1572 prefs::kProfileAvatarRightClickTutorialDismissed, true);
1573 } 1573 }
1574 1574
1575 // Loop over the profiles in reverse, so that they are sorted by their 1575 // Loop over the profiles in reverse, so that they are sorted by their
1576 // y-coordinate, and separate them into active and "other" profiles. 1576 // y-coordinate, and separate them into active and "other" profiles.
1577 for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) { 1577 for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) {
(...skipping 16 matching lines...) Expand all
1594 } 1594 }
1595 if (!currentProfileView) // Guest windows don't have an active profile. 1595 if (!currentProfileView) // Guest windows don't have an active profile.
1596 currentProfileView = [self createGuestProfileView]; 1596 currentProfileView = [self createGuestProfileView];
1597 1597
1598 // |yOffset| is the next position at which to draw in |container| 1598 // |yOffset| is the next position at which to draw in |container|
1599 // coordinates. Add a pixel offset so that the bottom option buttons don't 1599 // coordinates. Add a pixel offset so that the bottom option buttons don't
1600 // overlap the bubble's rounded corners. 1600 // overlap the bubble's rounded corners.
1601 CGFloat yOffset = 1; 1601 CGFloat yOffset = 1;
1602 1602
1603 if (isFastProfileChooser) { 1603 if (isFastProfileChooser) {
1604 if (!switches::IsMaterialDesignUserMenu()) { 1604 [self buildFastUserSwitcherViewWithProfiles:otherProfiles.get()
1605 [self buildFastUserSwitcherViewWithProfiles:otherProfiles.get() 1605 atYOffset:yOffset
1606 atYOffset:yOffset 1606 inContainer:container];
1607 inContainer:container];
1608 }
1609 } else { 1607 } else {
1610 [self buildProfileChooserViewWithProfileView:currentProfileView 1608 [self buildProfileChooserViewWithProfileView:currentProfileView
1611 tutorialView:tutorialView 1609 tutorialView:tutorialView
1612 syncErrorView:syncErrorView 1610 syncErrorView:syncErrorView
1613 otherProfiles:otherProfiles.get() 1611 otherProfiles:otherProfiles.get()
1614 atYOffset:yOffset 1612 atYOffset:yOffset
1615 inContainer:container 1613 inContainer:container
1616 showLock:showLock]; 1614 showLock:showLock];
1617 } 1615 }
1618 1616
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 } 2932 }
2935 2933
2936 - (bool)shouldShowGoIncognito { 2934 - (bool)shouldShowGoIncognito {
2937 bool incognitoAvailable = 2935 bool incognitoAvailable =
2938 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != 2936 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) !=
2939 IncognitoModePrefs::DISABLED; 2937 IncognitoModePrefs::DISABLED;
2940 return incognitoAvailable && !browser_->profile()->IsGuestSession(); 2938 return incognitoAvailable && !browser_->profile()->IsGuestSession();
2941 } 2939 }
2942 2940
2943 @end 2941 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698