Chromium Code Reviews| Index: chrome/browser/profiles/profile_manager.cc |
| diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
| index 6140d201f264a2dcd22f13cda83b38abbe0ead3d..3c6171bc1bb8645fdd1fcdc0ca6a7d9fcb36a0df 100644 |
| --- a/chrome/browser/profiles/profile_manager.cc |
| +++ b/chrome/browser/profiles/profile_manager.cc |
| @@ -36,6 +36,7 @@ |
| #include "chrome/browser/sync/profile_sync_service.h" |
| #include "chrome/browser/sync/profile_sync_service_factory.h" |
| #include "chrome/browser/ui/browser.h" |
| +#include "chrome/browser/ui/browser_iterator.h" |
| #include "chrome/browser/ui/sync/sync_promo_ui.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths_internal.h" |
| @@ -690,7 +691,23 @@ void ProfileManager::BrowserListObserver::OnBrowserAdded( |
| Browser* browser) {} |
| void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
| - Browser* browser) {} |
| + Browser* browser) { |
| + Profile* profile = browser->profile(); |
| + for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| + if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile()) |
| + // Not the last window for this profile. |
| + return; |
| + } |
| + |
| + // If it is the last browser of a profile scheduled for deleting then do that |
|
rpetterson
2013/10/04 19:42:20
Nit: deleting => deletion
pastarmovj
2013/10/10 11:46:32
Done.
|
| + // now. |
| + base::FilePath path = profile->GetPath(); |
| + if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles) && |
| + !IsProfileMarkedForDeletion(path)) { |
| + g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
| + path, ProfileManager::CreateCallback()); |
| + } |
| +} |
| void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( |
| Browser* browser) { |