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_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/avatar_menu.h" | 10 #include "chrome/browser/profiles/avatar_menu.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 Profile* activeProfile = ProfileManager::GetLastUsedProfile(); | 154 Profile* activeProfile = ProfileManager::GetLastUsedProfile(); |
155 if (activeProfile->IsGuestSession()) { | 155 if (activeProfile->IsGuestSession()) { |
156 return [menuItem action] != @selector(newProfile:) && | 156 return [menuItem action] != @selector(newProfile:) && |
157 [menuItem action] != @selector(editProfile:); | 157 [menuItem action] != @selector(editProfile:); |
158 } | 158 } |
159 | 159 |
160 const AvatarMenu::Item& itemData = menu_->GetItemAt( | 160 const AvatarMenu::Item& itemData = menu_->GetItemAt( |
161 menu_->GetActiveProfileIndex()); | 161 menu_->GetActiveProfileIndex()); |
162 if ([menuItem action] == @selector(switchToProfileFromDock:) || | 162 if ([menuItem action] == @selector(switchToProfileFromDock:) || |
163 [menuItem action] == @selector(switchToProfileFromMenu:)) { | 163 [menuItem action] == @selector(switchToProfileFromMenu:)) { |
164 if (!itemData.managed) | 164 if (!itemData.supervised) |
165 return YES; | 165 return YES; |
166 | 166 |
167 return [menuItem tag] == static_cast<NSInteger>(itemData.menu_index); | 167 return [menuItem tag] == static_cast<NSInteger>(itemData.menu_index); |
168 } | 168 } |
169 | 169 |
170 if ([menuItem action] == @selector(newProfile:)) | 170 if ([menuItem action] == @selector(newProfile:)) |
171 return !itemData.managed; | 171 return !itemData.supervised; |
172 | 172 |
173 return YES; | 173 return YES; |
174 } | 174 } |
175 | 175 |
176 // Private ///////////////////////////////////////////////////////////////////// | 176 // Private ///////////////////////////////////////////////////////////////////// |
177 | 177 |
178 - (NSMenu*)menu { | 178 - (NSMenu*)menu { |
179 return [mainMenuItem_ submenu]; | 179 return [mainMenuItem_ submenu]; |
180 } | 180 } |
181 | 181 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { | 251 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { |
252 base::scoped_nsobject<NSMenuItem> item( | 252 base::scoped_nsobject<NSMenuItem> item( |
253 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); | 253 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); |
254 [item setTarget:self]; | 254 [item setTarget:self]; |
255 return [item.release() autorelease]; | 255 return [item.release() autorelease]; |
256 } | 256 } |
257 | 257 |
258 @end | 258 @end |
OLD | NEW |