| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile_info_cache.h" | 8 #include "chrome/browser/profiles/profile_info_cache.h" |
| 9 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 9 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual ~ProfileRemovalObserver() { | 45 virtual ~ProfileRemovalObserver() { |
| 46 g_browser_process->profile_manager()->GetProfileInfoCache().RemoveObserver( | 46 g_browser_process->profile_manager()->GetProfileInfoCache().RemoveObserver( |
| 47 this); | 47 this); |
| 48 } | 48 } |
| 49 | 49 |
| 50 std::string last_used_profile_name() { return last_used_profile_name_; } | 50 std::string last_used_profile_name() { return last_used_profile_name_; } |
| 51 | 51 |
| 52 // ProfileInfoCacheObserver overrides: | 52 // ProfileInfoCacheObserver overrides: |
| 53 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE {} | |
| 54 virtual void OnProfileWillBeRemoved( | 53 virtual void OnProfileWillBeRemoved( |
| 55 const base::FilePath& profile_path) OVERRIDE { | 54 const base::FilePath& profile_path) OVERRIDE { |
| 56 last_used_profile_name_ = g_browser_process->local_state()->GetString( | 55 last_used_profile_name_ = g_browser_process->local_state()->GetString( |
| 57 prefs::kProfileLastUsed); | 56 prefs::kProfileLastUsed); |
| 58 } | 57 } |
| 59 virtual void OnProfileWasRemoved(const base::FilePath& profile_path, | |
| 60 const string16& profile_name) OVERRIDE {} | |
| 61 virtual void OnProfileNameChanged(const base::FilePath& profile_path, | |
| 62 const string16& old_profile_name) | |
| 63 OVERRIDE {} | |
| 64 virtual void OnProfileAvatarChanged(const base::FilePath& profile_path) | |
| 65 OVERRIDE {} | |
| 66 | 58 |
| 67 private: | 59 private: |
| 68 std::string last_used_profile_name_; | 60 std::string last_used_profile_name_; |
| 69 | 61 |
| 70 DISALLOW_COPY_AND_ASSIGN(ProfileRemovalObserver); | 62 DISALLOW_COPY_AND_ASSIGN(ProfileRemovalObserver); |
| 71 }; | 63 }; |
| 72 | 64 |
| 73 | 65 |
| 74 } // namespace | 66 } // namespace |
| 75 | 67 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 EXPECT_EQ(profile_manager->GetNumberOfProfiles(), 2U); | 173 EXPECT_EQ(profile_manager->GetNumberOfProfiles(), 2U); |
| 182 EXPECT_EQ(chrome::GetTotalBrowserCount(), 2U); | 174 EXPECT_EQ(chrome::GetTotalBrowserCount(), 2U); |
| 183 | 175 |
| 184 // Now close all browser windows. | 176 // Now close all browser windows. |
| 185 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); | 177 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); |
| 186 for (std::vector<Profile*>::const_iterator it = profiles.begin(); | 178 for (std::vector<Profile*>::const_iterator it = profiles.begin(); |
| 187 it != profiles.end(); ++it) { | 179 it != profiles.end(); ++it) { |
| 188 BrowserList::CloseAllBrowsersWithProfile(*it); | 180 BrowserList::CloseAllBrowsersWithProfile(*it); |
| 189 } | 181 } |
| 190 } | 182 } |
| OLD | NEW |