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/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 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 base::scoped_nsobject<NSView> container( | 1561 base::scoped_nsobject<NSView> container( |
1562 [[NSView alloc] initWithFrame:NSZeroRect]); | 1562 [[NSView alloc] initWithFrame:NSZeroRect]); |
1563 | 1563 |
1564 NSView* tutorialView = nil; | 1564 NSView* tutorialView = nil; |
1565 NSView* syncErrorView = nil; | 1565 NSView* syncErrorView = nil; |
1566 NSView* currentProfileView = nil; | 1566 NSView* currentProfileView = nil; |
1567 base::scoped_nsobject<NSMutableArray> otherProfiles( | 1567 base::scoped_nsobject<NSMutableArray> otherProfiles( |
1568 [[NSMutableArray alloc] init]); | 1568 [[NSMutableArray alloc] init]); |
1569 // Local and guest profiles cannot lock their profile. | 1569 // Local and guest profiles cannot lock their profile. |
1570 bool showLock = false; | 1570 bool showLock = false; |
1571 bool isFastProfileChooser = switches::IsMaterialDesignUserMenu() ? | 1571 bool isFastProfileChooser = |
1572 false : viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; | 1572 viewMode_ == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER; |
1573 if (isFastProfileChooser) { | 1573 if (isFastProfileChooser) { |
1574 // The user is using right-click switching, no need to tell them about it. | 1574 // The user is using right-click switching, no need to tell them about it. |
1575 PrefService* localState = g_browser_process->local_state(); | 1575 PrefService* localState = g_browser_process->local_state(); |
1576 localState->SetBoolean( | 1576 localState->SetBoolean( |
1577 prefs::kProfileAvatarRightClickTutorialDismissed, true); | 1577 prefs::kProfileAvatarRightClickTutorialDismissed, true); |
1578 } | 1578 } |
1579 | 1579 |
1580 // Loop over the profiles in reverse, so that they are sorted by their | 1580 // Loop over the profiles in reverse, so that they are sorted by their |
1581 // y-coordinate, and separate them into active and "other" profiles. | 1581 // y-coordinate, and separate them into active and "other" profiles. |
1582 for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) { | 1582 for (int i = avatarMenu_->GetNumberOfItems() - 1; i >= 0; --i) { |
(...skipping 16 matching lines...) Expand all Loading... |
1599 } | 1599 } |
1600 if (!currentProfileView) // Guest windows don't have an active profile. | 1600 if (!currentProfileView) // Guest windows don't have an active profile. |
1601 currentProfileView = [self createGuestProfileView]; | 1601 currentProfileView = [self createGuestProfileView]; |
1602 | 1602 |
1603 // |yOffset| is the next position at which to draw in |container| | 1603 // |yOffset| is the next position at which to draw in |container| |
1604 // coordinates. Add a pixel offset so that the bottom option buttons don't | 1604 // coordinates. Add a pixel offset so that the bottom option buttons don't |
1605 // overlap the bubble's rounded corners. | 1605 // overlap the bubble's rounded corners. |
1606 CGFloat yOffset = 1; | 1606 CGFloat yOffset = 1; |
1607 | 1607 |
1608 if (isFastProfileChooser) { | 1608 if (isFastProfileChooser) { |
1609 [self buildFastUserSwitcherViewWithProfiles:otherProfiles.get() | 1609 if (!switches::IsMaterialDesignUserMenu()) { |
1610 atYOffset:yOffset | 1610 [self buildFastUserSwitcherViewWithProfiles:otherProfiles.get() |
1611 inContainer:container]; | 1611 atYOffset:yOffset |
| 1612 inContainer:container]; |
| 1613 } |
1612 } else { | 1614 } else { |
1613 [self buildProfileChooserViewWithProfileView:currentProfileView | 1615 [self buildProfileChooserViewWithProfileView:currentProfileView |
1614 tutorialView:tutorialView | 1616 tutorialView:tutorialView |
1615 syncErrorView:syncErrorView | 1617 syncErrorView:syncErrorView |
1616 otherProfiles:otherProfiles.get() | 1618 otherProfiles:otherProfiles.get() |
1617 atYOffset:yOffset | 1619 atYOffset:yOffset |
1618 inContainer:container | 1620 inContainer:container |
1619 showLock:showLock]; | 1621 showLock:showLock]; |
1620 } | 1622 } |
1621 | 1623 |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2937 } | 2939 } |
2938 | 2940 |
2939 - (bool)shouldShowGoIncognito { | 2941 - (bool)shouldShowGoIncognito { |
2940 bool incognitoAvailable = | 2942 bool incognitoAvailable = |
2941 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2943 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2942 IncognitoModePrefs::DISABLED; | 2944 IncognitoModePrefs::DISABLED; |
2943 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2945 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2944 } | 2946 } |
2945 | 2947 |
2946 @end | 2948 @end |
OLD | NEW |