OLD | NEW |
---|---|
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 #include "chrome/browser/profiles/profile_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" | 29 #include "chrome/browser/profiles/bookmark_model_loaded_observer.h" |
30 #include "chrome/browser/profiles/profile_destroyer.h" | 30 #include "chrome/browser/profiles/profile_destroyer.h" |
31 #include "chrome/browser/profiles/profile_info_cache.h" | 31 #include "chrome/browser/profiles/profile_info_cache.h" |
32 #include "chrome/browser/profiles/profile_metrics.h" | 32 #include "chrome/browser/profiles/profile_metrics.h" |
33 #include "chrome/browser/profiles/profiles_state.h" | 33 #include "chrome/browser/profiles/profiles_state.h" |
34 #include "chrome/browser/profiles/startup_task_runner_service.h" | 34 #include "chrome/browser/profiles/startup_task_runner_service.h" |
35 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" | 35 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" |
36 #include "chrome/browser/sync/profile_sync_service.h" | 36 #include "chrome/browser/sync/profile_sync_service.h" |
37 #include "chrome/browser/sync/profile_sync_service_factory.h" | 37 #include "chrome/browser/sync/profile_sync_service_factory.h" |
38 #include "chrome/browser/ui/browser.h" | 38 #include "chrome/browser/ui/browser.h" |
39 #include "chrome/browser/ui/browser_iterator.h" | |
39 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 40 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
40 #include "chrome/common/chrome_constants.h" | 41 #include "chrome/common/chrome_constants.h" |
41 #include "chrome/common/chrome_paths_internal.h" | 42 #include "chrome/common/chrome_paths_internal.h" |
42 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/logging_chrome.h" | 44 #include "chrome/common/logging_chrome.h" |
44 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
45 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
46 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/notification_service.h" | 48 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/user_metrics.h" | 49 #include "content/public/browser/user_metrics.h" |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 } | 684 } |
684 | 685 |
685 ProfileManager::BrowserListObserver::~BrowserListObserver() { | 686 ProfileManager::BrowserListObserver::~BrowserListObserver() { |
686 BrowserList::RemoveObserver(this); | 687 BrowserList::RemoveObserver(this); |
687 } | 688 } |
688 | 689 |
689 void ProfileManager::BrowserListObserver::OnBrowserAdded( | 690 void ProfileManager::BrowserListObserver::OnBrowserAdded( |
690 Browser* browser) {} | 691 Browser* browser) {} |
691 | 692 |
692 void ProfileManager::BrowserListObserver::OnBrowserRemoved( | 693 void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
693 Browser* browser) {} | 694 Browser* browser) { |
695 Profile* profile = browser->profile(); | |
696 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | |
697 if (it->profile()->GetOriginalProfile() == profile->GetOriginalProfile()) | |
698 // Not the last window for this profile. | |
699 return; | |
700 } | |
701 | |
702 // 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.
| |
703 // now. | |
704 base::FilePath path = profile->GetPath(); | |
705 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles) && | |
706 !IsProfileMarkedForDeletion(path)) { | |
707 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | |
708 path, ProfileManager::CreateCallback()); | |
709 } | |
710 } | |
694 | 711 |
695 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( | 712 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( |
696 Browser* browser) { | 713 Browser* browser) { |
697 // If all browsers are being closed (e.g. the user is in the process of | 714 // If all browsers are being closed (e.g. the user is in the process of |
698 // shutting down), this event will be fired after each browser is | 715 // shutting down), this event will be fired after each browser is |
699 // closed. This does not represent a user intention to change the active | 716 // closed. This does not represent a user intention to change the active |
700 // browser so is not handled here. | 717 // browser so is not handled here. |
701 if (profile_manager_->closing_all_browsers_) | 718 if (profile_manager_->closing_all_browsers_) |
702 return; | 719 return; |
703 | 720 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1177 ProfileManager::ProfileInfo::ProfileInfo( | 1194 ProfileManager::ProfileInfo::ProfileInfo( |
1178 Profile* profile, | 1195 Profile* profile, |
1179 bool created) | 1196 bool created) |
1180 : profile(profile), | 1197 : profile(profile), |
1181 created(created) { | 1198 created(created) { |
1182 } | 1199 } |
1183 | 1200 |
1184 ProfileManager::ProfileInfo::~ProfileInfo() { | 1201 ProfileManager::ProfileInfo::~ProfileInfo() { |
1185 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1202 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1186 } | 1203 } |
OLD | NEW |