| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 #include "ui/base/l10n/l10n_util_mac.h" | 80 #include "ui/base/l10n/l10n_util_mac.h" |
| 81 #include "ui/base/resource/resource_bundle.h" | 81 #include "ui/base/resource/resource_bundle.h" |
| 82 #include "ui/events/keycodes/keyboard_codes.h" | 82 #include "ui/events/keycodes/keyboard_codes.h" |
| 83 #include "ui/gfx/color_palette.h" | 83 #include "ui/gfx/color_palette.h" |
| 84 #include "ui/gfx/image/image.h" | 84 #include "ui/gfx/image/image.h" |
| 85 #include "ui/gfx/image/image_skia_util_mac.h" | 85 #include "ui/gfx/image/image_skia_util_mac.h" |
| 86 #include "ui/gfx/paint_vector_icon.h" | 86 #include "ui/gfx/paint_vector_icon.h" |
| 87 #include "ui/gfx/text_elider.h" | 87 #include "ui/gfx/text_elider.h" |
| 88 #include "ui/native_theme/common_theme.h" | 88 #include "ui/native_theme/common_theme.h" |
| 89 #include "ui/native_theme/native_theme.h" | 89 #include "ui/native_theme/native_theme.h" |
| 90 #include "ui/vector_icons/vector_icons.h" |
| 90 | 91 |
| 91 namespace { | 92 namespace { |
| 92 | 93 |
| 93 // Constants taken from the Windows/Views implementation at: | 94 // Constants taken from the Windows/Views implementation at: |
| 94 // chrome/browser/ui/views/profile_chooser_view.cc | 95 // chrome/browser/ui/views/profile_chooser_view.cc |
| 95 const int kLargeImageSide = 88; | 96 const int kLargeImageSide = 88; |
| 96 const int kMdImageSide = 40; | 97 const int kMdImageSide = 40; |
| 97 | 98 |
| 98 const CGFloat kFixedMenuWidth = 240.0; | 99 const CGFloat kFixedMenuWidth = 240.0; |
| 99 const int kIconImageSide = 18; | 100 const int kIconImageSide = 18; |
| (...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 | 2191 |
| 2191 // Create a lock profile button when supervised users exist; otherwise, create | 2192 // Create a lock profile button when supervised users exist; otherwise, create |
| 2192 // a button that closes all of the current profile's windows if more than one | 2193 // a button that closes all of the current profile's windows if more than one |
| 2193 // is open. | 2194 // is open. |
| 2194 if (showLock) { | 2195 if (showLock) { |
| 2195 NSButton* lockButton = [self | 2196 NSButton* lockButton = [self |
| 2196 hoverButtonWithRect:viewRect | 2197 hoverButtonWithRect:viewRect |
| 2197 text:l10n_util::GetNSString( | 2198 text:l10n_util::GetNSString( |
| 2198 IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) | 2199 IDS_PROFILES_PROFILE_SIGNOUT_BUTTON) |
| 2199 image:NSImageFromImageSkia(gfx::CreateVectorIcon( | 2200 image:NSImageFromImageSkia(gfx::CreateVectorIcon( |
| 2200 kLockIcon, icon_size, gfx::kChromeIconGrey)) | 2201 ui::kLockIcon, icon_size, gfx::kChromeIconGrey)) |
| 2201 action:@selector(lockProfile:)]; | 2202 action:@selector(lockProfile:)]; |
| 2202 [container addSubview:lockButton]; | 2203 [container addSubview:lockButton]; |
| 2203 viewRect.origin.y = NSMaxY([lockButton frame]); | 2204 viewRect.origin.y = NSMaxY([lockButton frame]); |
| 2204 } else if (!isGuestSession_) { | 2205 } else if (!isGuestSession_) { |
| 2205 int num_browsers = 0; | 2206 int num_browsers = 0; |
| 2206 for (auto* browser : *BrowserList::GetInstance()) { | 2207 for (auto* browser : *BrowserList::GetInstance()) { |
| 2207 Profile* current_profile = browser_->profile()->GetOriginalProfile(); | 2208 Profile* current_profile = browser_->profile()->GetOriginalProfile(); |
| 2208 if (browser->profile()->GetOriginalProfile() == current_profile) | 2209 if (browser->profile()->GetOriginalProfile() == current_profile) |
| 2209 num_browsers++; | 2210 num_browsers++; |
| 2210 } | 2211 } |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 | 2647 |
| 2647 - (void)showWindow:(id)sender { | 2648 - (void)showWindow:(id)sender { |
| 2648 [super showWindow:sender]; | 2649 [super showWindow:sender]; |
| 2649 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; | 2650 NSEvent *event = [[NSApplication sharedApplication] currentEvent]; |
| 2650 if (firstProfileView_ && [event type] == NSKeyDown) { | 2651 if (firstProfileView_ && [event type] == NSKeyDown) { |
| 2651 [[self window] makeFirstResponder:firstProfileView_]; | 2652 [[self window] makeFirstResponder:firstProfileView_]; |
| 2652 } | 2653 } |
| 2653 } | 2654 } |
| 2654 | 2655 |
| 2655 @end | 2656 @end |
| OLD | NEW |