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 <set> | 5 #include <set> |
6 | 6 |
7 #include "chrome/browser/profiles/profile_manager.h" | 7 #include "chrome/browser/profiles/profile_manager.h" |
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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } | 632 } |
633 | 633 |
634 void ProfileManager::BrowserListObserver::OnBrowserAdded( | 634 void ProfileManager::BrowserListObserver::OnBrowserAdded( |
635 Browser* browser) {} | 635 Browser* browser) {} |
636 | 636 |
637 void ProfileManager::BrowserListObserver::OnBrowserRemoved( | 637 void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
638 Browser* browser) {} | 638 Browser* browser) {} |
639 | 639 |
640 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( | 640 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( |
641 Browser* browser) { | 641 Browser* browser) { |
| 642 // If all browsers are being closed (e.g. the user is in the process of |
| 643 // shutting down), this event will be fired after each browser is |
| 644 // closed. This does not represent a user intention to change the active |
| 645 // browser so is not handled here. |
| 646 if (profile_manager_->closing_all_browsers_) |
| 647 return; |
| 648 |
642 Profile* last_active = browser->profile(); | 649 Profile* last_active = browser->profile(); |
643 PrefService* local_state = g_browser_process->local_state(); | 650 PrefService* local_state = g_browser_process->local_state(); |
644 DCHECK(local_state); | 651 DCHECK(local_state); |
645 // Only keep track of profiles that we are managing; tests may create others. | 652 // Only keep track of profiles that we are managing; tests may create others. |
646 if (profile_manager_->profiles_info_.find( | 653 if (profile_manager_->profiles_info_.find( |
647 last_active->GetPath()) != profile_manager_->profiles_info_.end()) { | 654 last_active->GetPath()) != profile_manager_->profiles_info_.end()) { |
648 local_state->SetString(prefs::kProfileLastUsed, | 655 local_state->SetString(prefs::kProfileLastUsed, |
649 last_active->GetPath().BaseName().MaybeAsASCII()); | 656 last_active->GetPath().BaseName().MaybeAsASCII()); |
650 } | 657 } |
651 } | 658 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 1019 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
1013 Profile* profile, | 1020 Profile* profile, |
1014 Profile::CreateStatus status) { | 1021 Profile::CreateStatus status) { |
1015 for (size_t i = 0; i < callbacks.size(); ++i) | 1022 for (size_t i = 0; i < callbacks.size(); ++i) |
1016 callbacks[i].Run(profile, status); | 1023 callbacks[i].Run(profile, status); |
1017 } | 1024 } |
1018 | 1025 |
1019 ProfileManager::ProfileInfo::~ProfileInfo() { | 1026 ProfileManager::ProfileInfo::~ProfileInfo() { |
1020 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1027 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
1021 } | 1028 } |
OLD | NEW |