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 ad4ff7a673bcd909062a98ff98a6d4e44b13c6ea..f1624ab470f5a6b673a5eeabf64d291ded5f3c5c 100644 |
--- a/chrome/browser/ui/cocoa/profile_menu_controller.mm |
+++ b/chrome/browser/ui/cocoa/profile_menu_controller.mm |
@@ -84,7 +84,7 @@ class Observer : public BrowserList::Observer, |
} |
- (IBAction)editProfile:(id)sender { |
- model_->EditProfile([sender tag]); |
+ model_->EditProfile(model_->GetActiveProfileIndex()); |
} |
- (IBAction)newProfile:(id)sender { |
@@ -127,22 +127,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) ? YES : NO; |
Robert Sesek
2011/10/19 15:07:40
Why pull this out into a separate variable? The or
|
+ [[[self menu] itemWithTag:tag] setState:is_active ? NSOnState : NSOffState]; |
} |
} |