Index: chrome/browser/ui/cocoa/profile_menu_controller.mm |
diff --git a/chrome/browser/ui/cocoa/profile_menu_controller.mm b/chrome/browser/ui/cocoa/profile_menu_controller.mm |
index 7e0ff2bf189d8ee70ef6eaaaa3c55cdb7fb2a1d2..7a187dd6880a79199cd0e1a51f1dd061107435cd 100644 |
--- a/chrome/browser/ui/cocoa/profile_menu_controller.mm |
+++ b/chrome/browser/ui/cocoa/profile_menu_controller.mm |
@@ -83,6 +83,10 @@ class Observer : public BrowserList::Observer, |
model_->SwitchToProfile([sender tag]); |
} |
+- (IBAction)editCurrentProfile:(id)sender { |
Robert Sesek
2011/10/11 14:23:13
I don't think you need a new selector. You can onl
jeremy
2011/10/19 13:15:24
Done.
|
+ model_->EditProfile(model_->GetActiveProfileIndex()); |
+} |
+ |
- (IBAction)editProfile:(id)sender { |
model_->EditProfile([sender tag]); |
} |
@@ -109,7 +113,7 @@ class Observer : public BrowserList::Observer, |
NSMenuItem* item = |
[self createItemWithTitle:l10n_util::GetNSStringWithFixup( |
IDS_PROFILES_CUSTOMIZE_PROFILE) |
- action:@selector(editProfile:)]; |
+ action:@selector(editCurrentProfile:)]; |
[[self menu] addItem:item]; |
[[self menu] addItem:[NSMenuItem separatorItem]]; |
@@ -127,22 +131,13 @@ class Observer : public BrowserList::Observer, |
// Tell the model that the browser has changed. |
model_->set_browser(browser); |
- // Then find the profile to mark as active. |
- Profile* profile = NULL; |
- if (!browser) |
- profile = ProfileManager::GetLastUsedProfile(); |
- else |
- profile = browser->profile(); |
- |
- ProfileInfoInterface& info = |
- g_browser_process->profile_manager()->GetProfileInfoCache(); |
- size_t index = info.GetIndexOfProfileWithPath(profile->GetPath()); |
+ size_t active_profile_index = model_->GetActiveProfileIndex(); |
// Update the state for the menu items. |
for (size_t i = 0; i < model_->GetNumberOfItems(); ++i) { |
size_t tag = model_->GetItemAt(i).model_index; |
- [[[self menu] itemWithTag:tag] setState:index == tag ? NSOnState |
- : NSOffState]; |
+ bool is_active = active_profile_index == tag; |
Robert Sesek
2011/10/11 14:23:13
Use ObjC BOOL
jeremy
2011/10/19 13:15:24
Done.
|
+ [[[self menu] itemWithTag:tag] setState:is_active ? NSOnState : NSOffState]; |
} |
} |