| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 [NSApp activateIgnoringOtherApps:YES]; | 109 [NSApp activateIgnoringOtherApps:YES]; |
| 110 avatarMenu_->SwitchToProfile([sender tag], false, | 110 avatarMenu_->SwitchToProfile([sender tag], false, |
| 111 ProfileMetrics::SWITCH_PROFILE_DOCK); | 111 ProfileMetrics::SWITCH_PROFILE_DOCK); |
| 112 } | 112 } |
| 113 | 113 |
| 114 - (IBAction)editProfile:(id)sender { | 114 - (IBAction)editProfile:(id)sender { |
| 115 avatarMenu_->EditProfile(avatarMenu_->GetActiveProfileIndex()); | 115 avatarMenu_->EditProfile(avatarMenu_->GetActiveProfileIndex()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 - (IBAction)newProfile:(id)sender { | 118 - (IBAction)newProfile:(id)sender { |
| 119 profiles::CreateAndSwitchToNewProfile(chrome::HOST_DESKTOP_TYPE_NATIVE, | 119 profiles::CreateAndSwitchToNewProfile(ProfileManager::CreateCallback(), |
| 120 ProfileManager::CreateCallback(), | |
| 121 ProfileMetrics::ADD_NEW_USER_MENU); | 120 ProfileMetrics::ADD_NEW_USER_MENU); |
| 122 } | 121 } |
| 123 | 122 |
| 124 - (BOOL)insertItemsIntoMenu:(NSMenu*)menu | 123 - (BOOL)insertItemsIntoMenu:(NSMenu*)menu |
| 125 atOffset:(NSInteger)offset | 124 atOffset:(NSInteger)offset |
| 126 fromDock:(BOOL)dock { | 125 fromDock:(BOOL)dock { |
| 127 if (!avatarMenu_ || !avatarMenu_->ShouldShowAvatarMenu()) | 126 if (!avatarMenu_ || !avatarMenu_->ShouldShowAvatarMenu()) |
| 128 return NO; | 127 return NO; |
| 129 | 128 |
| 130 // Don't show the list of profiles in the dock if only one profile exists. | 129 // Don't show the list of profiles in the dock if only one profile exists. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 302 } |
| 304 | 303 |
| 305 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { | 304 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { |
| 306 base::scoped_nsobject<NSMenuItem> item( | 305 base::scoped_nsobject<NSMenuItem> item( |
| 307 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); | 306 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); |
| 308 [item setTarget:self]; | 307 [item setTarget:self]; |
| 309 return [item.release() autorelease]; | 308 return [item.release() autorelease]; |
| 310 } | 309 } |
| 311 | 310 |
| 312 @end | 311 @end |
| OLD | NEW |