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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 ProfileManager* manager) | 600 ProfileManager* manager) |
601 : profile_manager_(manager) { | 601 : profile_manager_(manager) { |
602 BrowserList::AddObserver(this); | 602 BrowserList::AddObserver(this); |
603 } | 603 } |
604 | 604 |
605 ProfileManager::BrowserListObserver::~BrowserListObserver() { | 605 ProfileManager::BrowserListObserver::~BrowserListObserver() { |
606 BrowserList::RemoveObserver(this); | 606 BrowserList::RemoveObserver(this); |
607 } | 607 } |
608 | 608 |
609 void ProfileManager::BrowserListObserver::OnBrowserAdded( | 609 void ProfileManager::BrowserListObserver::OnBrowserAdded( |
610 const Browser* browser) {} | 610 Browser* browser) {} |
611 | 611 |
612 void ProfileManager::BrowserListObserver::OnBrowserRemoved( | 612 void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
613 const Browser* browser) {} | 613 Browser* browser) {} |
614 | 614 |
615 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( | 615 void ProfileManager::BrowserListObserver::OnBrowserSetLastActive( |
616 const Browser* browser) { | 616 Browser* browser) { |
617 Profile* last_active = browser->profile(); | 617 Profile* last_active = browser->profile(); |
618 PrefService* local_state = g_browser_process->local_state(); | 618 PrefService* local_state = g_browser_process->local_state(); |
619 DCHECK(local_state); | 619 DCHECK(local_state); |
620 // Only keep track of profiles that we are managing; tests may create others. | 620 // Only keep track of profiles that we are managing; tests may create others. |
621 if (profile_manager_->profiles_info_.find( | 621 if (profile_manager_->profiles_info_.find( |
622 last_active->GetPath()) != profile_manager_->profiles_info_.end()) { | 622 last_active->GetPath()) != profile_manager_->profiles_info_.end()) { |
623 local_state->SetString(prefs::kProfileLastUsed, | 623 local_state->SetString(prefs::kProfileLastUsed, |
624 last_active->GetPath().BaseName().MaybeAsASCII()); | 624 last_active->GetPath().BaseName().MaybeAsASCII()); |
625 } | 625 } |
626 } | 626 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, | 974 void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
975 Profile* profile, | 975 Profile* profile, |
976 Profile::CreateStatus status) { | 976 Profile::CreateStatus status) { |
977 for (size_t i = 0; i < callbacks.size(); ++i) | 977 for (size_t i = 0; i < callbacks.size(); ++i) |
978 callbacks[i].Run(profile, status); | 978 callbacks[i].Run(profile, status); |
979 } | 979 } |
980 | 980 |
981 ProfileManager::ProfileInfo::~ProfileInfo() { | 981 ProfileManager::ProfileInfo::~ProfileInfo() { |
982 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 982 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
983 } | 983 } |
OLD | NEW |