| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profile_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // before the message loop starts and g_browser_process is available. | 75 // before the message loop starts and g_browser_process is available. |
| 76 // Schedule this on the loop to do work when the browser is ready. | 76 // Schedule this on the loop to do work when the browser is ready. |
| 77 [self performSelector:@selector(initializeMenu) | 77 [self performSelector:@selector(initializeMenu) |
| 78 withObject:nil | 78 withObject:nil |
| 79 afterDelay:0]; | 79 afterDelay:0]; |
| 80 } | 80 } |
| 81 return self; | 81 return self; |
| 82 } | 82 } |
| 83 | 83 |
| 84 - (IBAction)switchToProfileFromMenu:(id)sender { | 84 - (IBAction)switchToProfileFromMenu:(id)sender { |
| 85 menu_->SwitchToProfile([sender tag], false); | 85 menu_->SwitchToProfile([sender tag], false, |
| 86 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_MENU); | 86 ProfileMetrics::SWITCH_PROFILE_MENU); |
| 87 } | 87 } |
| 88 | 88 |
| 89 - (IBAction)switchToProfileFromDock:(id)sender { | 89 - (IBAction)switchToProfileFromDock:(id)sender { |
| 90 // Explicitly bring to the foreground when taking action from the dock. | 90 // Explicitly bring to the foreground when taking action from the dock. |
| 91 [NSApp activateIgnoringOtherApps:YES]; | 91 [NSApp activateIgnoringOtherApps:YES]; |
| 92 menu_->SwitchToProfile([sender tag], false); | 92 menu_->SwitchToProfile([sender tag], false, |
| 93 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_DOCK); | 93 ProfileMetrics::SWITCH_PROFILE_DOCK); |
| 94 } | 94 } |
| 95 | 95 |
| 96 - (IBAction)editProfile:(id)sender { | 96 - (IBAction)editProfile:(id)sender { |
| 97 menu_->EditProfile(menu_->GetActiveProfileIndex()); | 97 menu_->EditProfile(menu_->GetActiveProfileIndex()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 - (IBAction)newProfile:(id)sender { | 100 - (IBAction)newProfile:(id)sender { |
| 101 menu_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_MENU); | 101 menu_->AddNewProfile(ProfileMetrics::ADD_NEW_USER_MENU); |
| 102 } | 102 } |
| 103 | 103 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 239 } |
| 240 | 240 |
| 241 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { | 241 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { |
| 242 base::scoped_nsobject<NSMenuItem> item( | 242 base::scoped_nsobject<NSMenuItem> item( |
| 243 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); | 243 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); |
| 244 [item setTarget:self]; | 244 [item setTarget:self]; |
| 245 return [item.release() autorelease]; | 245 return [item.release() autorelease]; |
| 246 } | 246 } |
| 247 | 247 |
| 248 @end | 248 @end |
| OLD | NEW |