Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1768)

Unified Diff: chrome/browser/ui/cocoa/profile_menu_controller.mm

Issue 8230011: [Mac/multiprofile] "Customize User..." should edit the currently active profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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];
}
}

Powered by Google App Engine
This is Rietveld 408576698