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

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 953453002: Wait until a new profile has been created before deleting the active profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: test 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/app_controller_mac.h" 5 #import "chrome/browser/app_controller_mac.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 TabRestoreServiceFactory::GetForProfile([self lastProfile]); 890 TabRestoreServiceFactory::GetForProfile([self lastProfile]);
891 return service && !service->entries().empty(); 891 return service && !service->entries().empty();
892 } 892 }
893 893
894 // Called from the AppControllerProfileObserver every time a profile is deleted. 894 // Called from the AppControllerProfileObserver every time a profile is deleted.
895 - (void)profileWasRemoved:(const base::FilePath&)profilePath { 895 - (void)profileWasRemoved:(const base::FilePath&)profilePath {
896 // If the lastProfile has been deleted, the profile manager has 896 // If the lastProfile has been deleted, the profile manager has
897 // already loaded a new one, so the pointer needs to be updated; 897 // already loaded a new one, so the pointer needs to be updated;
898 // otherwise we will try to start up a browser window with a pointer 898 // otherwise we will try to start up a browser window with a pointer
899 // to the old profile. 899 // to the old profile.
900 if (lastProfile_ && profilePath == lastProfile_->GetPath()) 900 if (!lastProfile_ || profilePath == lastProfile_->GetPath())
noms (inactive) 2015/02/24 19:37:37 i'm confused. is this a real change or a test? :(
Bernhard Bauer 2015/02/24 22:28:24 Allow me to explain: |lastProfile_| starts out as
Mike Lerman 2015/02/25 18:32:10 Makes sense - can you modify the above comment blo
Bernhard Bauer 2015/02/25 18:42:34 Done.
901 lastProfile_ = g_browser_process->profile_manager()->GetLastUsedProfile(); 901 lastProfile_ = g_browser_process->profile_manager()->GetLastUsedProfile();
902 902
903 auto it = profileBookmarkMenuBridgeMap_.find(profilePath); 903 auto it = profileBookmarkMenuBridgeMap_.find(profilePath);
904 if (it != profileBookmarkMenuBridgeMap_.end()) { 904 if (it != profileBookmarkMenuBridgeMap_.end()) {
905 delete it->second; 905 delete it->second;
906 profileBookmarkMenuBridgeMap_.erase(it); 906 profileBookmarkMenuBridgeMap_.erase(it);
907 } 907 }
908 } 908 }
909 909
910 // Returns true if there is a modal window (either window- or application- 910 // Returns true if there is a modal window (either window- or application-
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 1707
1708 //--------------------------------------------------------------------------- 1708 //---------------------------------------------------------------------------
1709 1709
1710 namespace app_controller_mac { 1710 namespace app_controller_mac {
1711 1711
1712 bool IsOpeningNewWindow() { 1712 bool IsOpeningNewWindow() {
1713 return g_is_opening_new_window; 1713 return g_is_opening_new_window;
1714 } 1714 }
1715 1715
1716 } // namespace app_controller_mac 1716 } // namespace app_controller_mac
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698