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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 929073002: Only return fully initialized profiles in ProfileManager::GetProfileByPath. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: cleanup Created 5 years, 10 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/app_controller_mac.mm
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 41043f7feab90aaff364376861d963a6b9324bab..01feef4dbf749ac126f1cc56fec71712c3104fd7 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -893,18 +893,14 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// Called from the AppControllerProfileObserver every time a profile is deleted.
- (void)profileWasRemoved:(const base::FilePath&)profilePath {
- Profile* lastProfile = [self lastProfile];
-
// If the lastProfile has been deleted, the profile manager has
// already loaded a new one, so the pointer needs to be updated;
// otherwise we will try to start up a browser window with a pointer
// to the old profile.
- if (profilePath == lastProfile->GetPath())
+ if (lastProfile_ && profilePath == lastProfile_->GetPath())
lastProfile_ = g_browser_process->profile_manager()->GetLastUsedProfile();
- Profile* profile =
- g_browser_process->profile_manager()->GetProfile(profilePath);
- auto it = profileBookmarkMenuBridgeMap_.find(profile);
+ auto it = profileBookmarkMenuBridgeMap_.find(profilePath);
if (it != profileBookmarkMenuBridgeMap_.end()) {
delete it->second;
profileBookmarkMenuBridgeMap_.erase(it);
@@ -1582,12 +1578,12 @@ class AppControllerProfileObserver : public ProfileInfoCacheObserver {
// Rebuild the menus with the new profile.
lastProfile_ = profile;
- auto it = profileBookmarkMenuBridgeMap_.find(profile);
+ auto it = profileBookmarkMenuBridgeMap_.find(profile->GetPath());
if (it == profileBookmarkMenuBridgeMap_.end()) {
base::scoped_nsobject<NSMenu> submenu(
[[[[NSApp mainMenu] itemWithTag:IDC_BOOKMARKS_MENU] submenu] copy]);
- bookmarkMenuBridge_ = new BookmarkMenuBridge(lastProfile_, submenu);
- profileBookmarkMenuBridgeMap_[profile] = bookmarkMenuBridge_;
+ bookmarkMenuBridge_ = new BookmarkMenuBridge(profile, submenu);
+ profileBookmarkMenuBridgeMap_[profile->GetPath()] = bookmarkMenuBridge_;
} else {
bookmarkMenuBridge_ = it->second;
}

Powered by Google App Engine
This is Rietveld 408576698