OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/avatar_menu_model.h" | 9 #include "chrome/browser/profiles/avatar_menu_model.h" |
10 #include "chrome/browser/profiles/avatar_menu_model_observer.h" | 10 #include "chrome/browser/profiles/avatar_menu_model_observer.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Schedule this on the loop to do work when the browser is ready. | 75 // Schedule this on the loop to do work when the browser is ready. |
76 [self performSelector:@selector(initializeMenu) | 76 [self performSelector:@selector(initializeMenu) |
77 withObject:nil | 77 withObject:nil |
78 afterDelay:0]; | 78 afterDelay:0]; |
79 } | 79 } |
80 return self; | 80 return self; |
81 } | 81 } |
82 | 82 |
83 - (IBAction)switchToProfile:(id)sender { | 83 - (IBAction)switchToProfile:(id)sender { |
84 model_->SwitchToProfile([sender tag]); | 84 model_->SwitchToProfile([sender tag]); |
85 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::SWITCH_PROFILE_MENU); | 85 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_MENU); |
86 } | 86 } |
87 | 87 |
88 - (IBAction)editProfile:(id)sender { | 88 - (IBAction)editProfile:(id)sender { |
89 model_->EditProfile(model_->GetActiveProfileIndex()); | 89 model_->EditProfile(model_->GetActiveProfileIndex()); |
90 } | 90 } |
91 | 91 |
92 - (IBAction)newProfile:(id)sender { | 92 - (IBAction)newProfile:(id)sender { |
93 model_->AddNewProfile(); | 93 model_->AddNewProfile(); |
94 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ADD_NEW_USER); | 94 ProfileMetrics::LogProfileAddNewUser(ProfileMetrics::ADD_NEW_USER_MENU); |
95 ProfileMetrics::LogProfileOpenMethod(ProfileMetrics::ADD_NEW_USER_MENU); | |
96 } | 95 } |
97 | 96 |
98 // Private ///////////////////////////////////////////////////////////////////// | 97 // Private ///////////////////////////////////////////////////////////////////// |
99 | 98 |
100 - (NSMenu*)menu { | 99 - (NSMenu*)menu { |
101 return [mainMenuItem_ submenu]; | 100 return [mainMenuItem_ submenu]; |
102 } | 101 } |
103 | 102 |
104 - (void)initializeMenu { | 103 - (void)initializeMenu { |
105 observer_.reset(new ProfileMenuControllerInternal::Observer(self)); | 104 observer_.reset(new ProfileMenuControllerInternal::Observer(self)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 166 } |
168 | 167 |
169 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { | 168 - (NSMenuItem*)createItemWithTitle:(NSString*)title action:(SEL)sel { |
170 scoped_nsobject<NSMenuItem> item( | 169 scoped_nsobject<NSMenuItem> item( |
171 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); | 170 [[NSMenuItem alloc] initWithTitle:title action:sel keyEquivalent:@""]); |
172 [item setTarget:self]; | 171 [item setTarget:self]; |
173 return [item.release() autorelease]; | 172 return [item.release() autorelease]; |
174 } | 173 } |
175 | 174 |
176 @end | 175 @end |
OLD | NEW |