Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 registrar_.Add( | 207 registrar_.Add( |
| 208 this, | 208 this, |
| 209 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 209 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
| 210 content::NotificationService::AllSources()); | 210 content::NotificationService::AllSources()); |
| 211 #endif | 211 #endif |
| 212 } | 212 } |
| 213 | 213 |
| 214 ProfileManager::~ProfileManager() { | 214 ProfileManager::~ProfileManager() { |
| 215 BrowserList::RemoveObserver(this); | 215 BrowserList::RemoveObserver(this); |
| 216 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
| 217 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); | 217 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 218 if (!command_line.HasSwitch(switches::kNoFirstRun)) | |
|
robertshield
2011/11/30 20:07:48
I would replace the condition with
if (profile_sh
Miranda Callahan
2011/11/30 20:18:24
Indeed! Fixed.
| |
| 219 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); | |
| 218 #endif | 220 #endif |
| 219 } | 221 } |
| 220 | 222 |
| 221 FilePath ProfileManager::GetDefaultProfileDir( | 223 FilePath ProfileManager::GetDefaultProfileDir( |
| 222 const FilePath& user_data_dir) { | 224 const FilePath& user_data_dir) { |
| 223 FilePath default_profile_dir(user_data_dir); | 225 FilePath default_profile_dir(user_data_dir); |
| 224 default_profile_dir = | 226 default_profile_dir = |
| 225 default_profile_dir.AppendASCII(chrome::kInitialProfile); | 227 default_profile_dir.AppendASCII(chrome::kInitialProfile); |
| 226 return default_profile_dir; | 228 return default_profile_dir; |
| 227 } | 229 } |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 } else { | 588 } else { |
| 587 return pair1.first < pair2.first; | 589 return pair1.first < pair2.first; |
| 588 } | 590 } |
| 589 } | 591 } |
| 590 | 592 |
| 591 ProfileInfoCache& ProfileManager::GetProfileInfoCache() { | 593 ProfileInfoCache& ProfileManager::GetProfileInfoCache() { |
| 592 if (!profile_info_cache_.get()) { | 594 if (!profile_info_cache_.get()) { |
| 593 profile_info_cache_.reset(new ProfileInfoCache( | 595 profile_info_cache_.reset(new ProfileInfoCache( |
| 594 g_browser_process->local_state(), user_data_dir_)); | 596 g_browser_process->local_state(), user_data_dir_)); |
| 595 #if defined(OS_WIN) | 597 #if defined(OS_WIN) |
| 596 profile_shortcut_manager_.reset(new ProfileShortcutManagerWin()); | 598 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 597 profile_info_cache_->AddObserver(profile_shortcut_manager_.get()); | 599 if (!command_line.HasSwitch(switches::kNoFirstRun)) { |
| 600 profile_shortcut_manager_.reset(new ProfileShortcutManagerWin()); | |
| 601 profile_info_cache_->AddObserver(profile_shortcut_manager_.get()); | |
| 602 } | |
| 598 #endif | 603 #endif |
| 599 } | 604 } |
| 600 return *profile_info_cache_.get(); | 605 return *profile_info_cache_.get(); |
| 601 } | 606 } |
| 602 | 607 |
| 603 void ProfileManager::AddProfileToCache(Profile* profile) { | 608 void ProfileManager::AddProfileToCache(Profile* profile) { |
| 604 ProfileInfoCache& cache = GetProfileInfoCache(); | 609 ProfileInfoCache& cache = GetProfileInfoCache(); |
| 605 if (profile->GetPath().DirName() != cache.GetUserDataDir()) | 610 if (profile->GetPath().DirName() != cache.GetUserDataDir()) |
| 606 return; | 611 return; |
| 607 | 612 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 RegisterProfile(profile, true); | 710 RegisterProfile(profile, true); |
| 706 if (add_to_cache) | 711 if (add_to_cache) |
| 707 AddProfileToCache(profile); | 712 AddProfileToCache(profile); |
| 708 } | 713 } |
| 709 | 714 |
| 710 #if defined(OS_WIN) | 715 #if defined(OS_WIN) |
| 711 void ProfileManager::RemoveProfileShortcutManagerForTesting() { | 716 void ProfileManager::RemoveProfileShortcutManagerForTesting() { |
| 712 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); | 717 profile_info_cache_->RemoveObserver(profile_shortcut_manager_.get()); |
| 713 } | 718 } |
| 714 #endif | 719 #endif |
| OLD | NEW |