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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 Profile* activeProfile = ProfileManager::GetLastUsedProfile(); | 166 Profile* activeProfile = ProfileManager::GetLastUsedProfile(); |
167 if (activeProfile->IsGuestSession()) { | 167 if (activeProfile->IsGuestSession()) { |
168 return [menuItem action] != @selector(newProfile:) && | 168 return [menuItem action] != @selector(newProfile:) && |
169 [menuItem action] != @selector(editProfile:); | 169 [menuItem action] != @selector(editProfile:); |
170 } | 170 } |
171 | 171 |
172 const AvatarMenu::Item& itemData = avatarMenu_->GetItemAt( | 172 const AvatarMenu::Item& itemData = avatarMenu_->GetItemAt( |
173 avatarMenu_->GetActiveProfileIndex()); | 173 avatarMenu_->GetActiveProfileIndex()); |
174 if ([menuItem action] == @selector(switchToProfileFromDock:) || | 174 if ([menuItem action] == @selector(switchToProfileFromDock:) || |
175 [menuItem action] == @selector(switchToProfileFromMenu:)) { | 175 [menuItem action] == @selector(switchToProfileFromMenu:)) { |
176 if (!itemData.supervised) | 176 if (!itemData.legacy_supervised) |
177 return YES; | 177 return YES; |
178 | 178 |
179 return [menuItem tag] == static_cast<NSInteger>(itemData.menu_index); | 179 return [menuItem tag] == static_cast<NSInteger>(itemData.menu_index); |
180 } | 180 } |
181 | 181 |
182 if ([menuItem action] == @selector(newProfile:)) | 182 if ([menuItem action] == @selector(newProfile:)) |
183 return !itemData.supervised; | 183 return !itemData.legacy_supervised; |
184 | 184 |
185 return YES; | 185 return YES; |
186 } | 186 } |
187 | 187 |
188 // Private ///////////////////////////////////////////////////////////////////// | 188 // Private ///////////////////////////////////////////////////////////////////// |
189 | 189 |
190 - (NSMenu*)menu { | 190 - (NSMenu*)menu { |
191 return [mainMenuItem_ submenu]; | 191 return [mainMenuItem_ submenu]; |
192 } | 192 } |
193 | 193 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 } | 263 } |
264 | 264 |
265 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { | 265 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { |
266 base::scoped_nsobject<NSMenuItem> item( | 266 base::scoped_nsobject<NSMenuItem> item( |
267 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); | 267 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); |
268 [item setTarget:self]; | 268 [item setTarget:self]; |
269 return [item.release() autorelease]; | 269 return [item.release() autorelease]; |
270 } | 270 } |
271 | 271 |
272 @end | 272 @end |
OLD | NEW |