| 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/avatar_icon_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const int icon_id = profile->IsGuestSession() ? | 104 const int icon_id = profile->IsGuestSession() ? |
| 105 profiles::GetPlaceholderAvatarIconResourceID() : IDR_OTR_ICON; | 105 profiles::GetPlaceholderAvatarIconResourceID() : IDR_OTR_ICON; |
| 106 NSImage* icon = ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 106 NSImage* icon = ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
| 107 icon_id).ToNSImage(); | 107 icon_id).ToNSImage(); |
| 108 [self setImage:[self compositeImageWithShadow:icon]]; | 108 [self setImage:[self compositeImageWithShadow:icon]]; |
| 109 [self setButtonEnabled:profile->IsGuestSession()]; | 109 [self setButtonEnabled:profile->IsGuestSession()]; |
| 110 } else { | 110 } else { |
| 111 [self setButtonEnabled:YES]; | 111 [self setButtonEnabled:YES]; |
| 112 [self updateAvatarButtonAndLayoutParent:NO]; | 112 [self updateAvatarButtonAndLayoutParent:NO]; |
| 113 | 113 |
| 114 // Managed users cannot enter incognito mode, so we only need to check | 114 // Supervised users cannot enter incognito mode, so we only need to check |
| 115 // it in this code path. | 115 // it in this code path. |
| 116 if (profile->IsManaged()) { | 116 if (profile->IsSupervised()) { |
| 117 // Initialize the avatar label button. | 117 // Initialize the avatar label button. |
| 118 CGFloat extraWidth = | 118 CGFloat extraWidth = |
| 119 profiles::kAvatarIconWidth + kAvatarLabelRightSpacing; | 119 profiles::kAvatarIconWidth + kAvatarLabelRightSpacing; |
| 120 NSRect frame = NSMakeRect( | 120 NSRect frame = NSMakeRect( |
| 121 kAvatarSpacing, kAvatarLabelBottomSpacing, extraWidth, 0); | 121 kAvatarSpacing, kAvatarLabelBottomSpacing, extraWidth, 0); |
| 122 labelButton_.reset([[AvatarLabelButton alloc] initWithFrame:frame]); | 122 labelButton_.reset([[AvatarLabelButton alloc] initWithFrame:frame]); |
| 123 [labelButton_ setTarget:self]; | 123 [labelButton_ setTarget:self]; |
| 124 [labelButton_ setAction:@selector(buttonClicked:)]; | 124 [labelButton_ setAction:@selector(buttonClicked:)]; |
| 125 [[self view] addSubview:labelButton_]; | 125 [[self view] addSubview:labelButton_]; |
| 126 | 126 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // needs to be adjusted. Since the fullscreen button is positioned by | 234 // needs to be adjusted. Since the fullscreen button is positioned by |
| 235 // FramedBrowserWindow using private APIs, the easiest way to update the | 235 // FramedBrowserWindow using private APIs, the easiest way to update the |
| 236 // position of the button is through this private API. Resizing the window | 236 // position of the button is through this private API. Resizing the window |
| 237 // also works, but invoking |-display| does not. | 237 // also works, but invoking |-display| does not. |
| 238 NSView* themeFrame = [[[wc window] contentView] superview]; | 238 NSView* themeFrame = [[[wc window] contentView] superview]; |
| 239 if ([themeFrame respondsToSelector:@selector(_tileTitlebarAndRedisplay:)]) | 239 if ([themeFrame respondsToSelector:@selector(_tileTitlebarAndRedisplay:)]) |
| 240 [themeFrame _tileTitlebarAndRedisplay:YES]; | 240 [themeFrame _tileTitlebarAndRedisplay:YES]; |
| 241 } | 241 } |
| 242 | 242 |
| 243 @end | 243 @end |
| OLD | NEW |