Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_menu_controller.mm

Issue 1128173005: Clean up ProfileManager interface. Base URL: https://chromium.googlesource.com/chromium/src@issue479309
Patch Set: sync Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 171 }
172 [menu insertItem:item atIndex:i + offset]; 172 [menu insertItem:item atIndex:i + offset];
173 } 173 }
174 174
175 return YES; 175 return YES;
176 } 176 }
177 177
178 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { 178 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
179 // In guest mode, chrome://settings isn't available, so disallow creating 179 // In guest mode, chrome://settings isn't available, so disallow creating
180 // or editing a profile. 180 // or editing a profile.
181 Profile* activeProfile = ProfileManager::GetLastUsedProfile(); 181 Profile* activeProfile =
182 g_browser_process->profile_manager()->GetLastUsedProfile();
182 if (activeProfile->IsGuestSession()) { 183 if (activeProfile->IsGuestSession()) {
183 return [menuItem action] != @selector(newProfile:) && 184 return [menuItem action] != @selector(newProfile:) &&
184 [menuItem action] != @selector(editProfile:); 185 [menuItem action] != @selector(editProfile:);
185 } 186 }
186 187
187 size_t index = avatarMenu_->GetActiveProfileIndex(); 188 size_t index = avatarMenu_->GetActiveProfileIndex();
188 if (avatarMenu_->GetNumberOfItems() <= index) { 189 if (avatarMenu_->GetNumberOfItems() <= index) {
189 ValidateMenuItemSelector currentSelector = UNKNOWN_SELECTOR; 190 ValidateMenuItemSelector currentSelector = UNKNOWN_SELECTOR;
190 if ([menuItem action] == @selector(newProfile:)) 191 if ([menuItem action] == @selector(newProfile:))
191 currentSelector = NEW_PROFILE; 192 currentSelector = NEW_PROFILE;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 302 }
302 303
303 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { 304 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel {
304 base::scoped_nsobject<NSMenuItem> item( 305 base::scoped_nsobject<NSMenuItem> item(
305 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); 306 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]);
306 [item setTarget:self]; 307 [item setTarget:self];
307 return [item.release() autorelease]; 308 return [item.release() autorelease];
308 } 309 }
309 310
310 @end 311 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_common.cc ('k') | chrome/browser/ui/startup/startup_browser_creator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698