Chromium Code Reviews| 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 <AppKit/NSEvent.h> | |
|
Mark Mentovai
2017/02/06 19:39:18
We don’t do this in Chrome, we just #import the to
jlebel
2017/02/07 10:03:26
Yes, this import is not necessary. Sorry.
| |
| 7 #import <Carbon/Carbon.h> // kVK_Return. | 8 #import <Carbon/Carbon.h> // kVK_Return. |
| 8 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 9 #include <stddef.h> | 10 #include <stddef.h> |
| 10 | 11 |
| 11 #include "base/mac/bundle_locations.h" | 12 #include "base/mac/bundle_locations.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/metrics/user_metrics.h" | 14 #include "base/metrics/user_metrics.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| (...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1587 } else if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { | 1588 } else if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) { |
| 1588 tutorialView = [self buildTutorialViewIfNeededForItem:item]; | 1589 tutorialView = [self buildTutorialViewIfNeededForItem:item]; |
| 1589 } | 1590 } |
| 1590 currentProfileView = | 1591 currentProfileView = |
| 1591 switches::IsMaterialDesignUserMenu() | 1592 switches::IsMaterialDesignUserMenu() |
| 1592 ? [self createMaterialDesignCurrentProfileView:item] | 1593 ? [self createMaterialDesignCurrentProfileView:item] |
| 1593 : [self createCurrentProfileView:item]; | 1594 : [self createCurrentProfileView:item]; |
| 1594 showLock = item.signed_in && | 1595 showLock = item.signed_in && |
| 1595 profiles::IsLockAvailable(browser_->profile()); | 1596 profiles::IsLockAvailable(browser_->profile()); |
| 1596 } else { | 1597 } else { |
| 1597 [otherProfiles addObject:[self createOtherProfileView:i]]; | 1598 NSButton* otherProfileView = [self createOtherProfileView:i]; |
| 1599 if (!firstProfileView_) { | |
| 1600 firstProfileView_ = otherProfileView; | |
| 1601 } | |
| 1602 [otherProfiles addObject:otherProfileView]; | |
| 1598 } | 1603 } |
| 1599 } | 1604 } |
| 1600 if (!currentProfileView) // Guest windows don't have an active profile. | 1605 if (!currentProfileView) // Guest windows don't have an active profile. |
| 1601 currentProfileView = [self createGuestProfileView]; | 1606 currentProfileView = [self createGuestProfileView]; |
| 1602 | 1607 |
| 1603 // |yOffset| is the next position at which to draw in |container| | 1608 // |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 | 1609 // coordinates. Add a pixel offset so that the bottom option buttons don't |
| 1605 // overlap the bubble's rounded corners. | 1610 // overlap the bubble's rounded corners. |
| 1606 CGFloat yOffset = 1; | 1611 CGFloat yOffset = 1; |
| 1607 | 1612 |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2938 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE; | 2943 serviceType_ = signin::GAIA_SERVICE_TYPE_NONE; |
| 2939 } | 2944 } |
| 2940 | 2945 |
| 2941 - (bool)shouldShowGoIncognito { | 2946 - (bool)shouldShowGoIncognito { |
| 2942 bool incognitoAvailable = | 2947 bool incognitoAvailable = |
| 2943 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2948 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
| 2944 IncognitoModePrefs::DISABLED; | 2949 IncognitoModePrefs::DISABLED; |
| 2945 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2950 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
| 2946 } | 2951 } |
| 2947 | 2952 |
| 2953 - (void)showWindow:(id)sender { | |
| 2954 [super showWindow:sender]; | |
| 2955 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; | |
| 2956 if (firstProfileView_ && [event type] == NSKeyDown) { | |
| 2957 [[self window] makeFirstResponder:firstProfileView_]; | |
| 2958 } | |
| 2959 } | |
| 2960 | |
| 2948 @end | 2961 @end |
| OLD | NEW |