| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/profile_manager.h" | 7 #include "chrome/browser/profile_manager.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 ProfileManager::~ProfileManager() { | 65 ProfileManager::~ProfileManager() { |
| 66 SystemMonitor* system_monitor = SystemMonitor::Get(); | 66 SystemMonitor* system_monitor = SystemMonitor::Get(); |
| 67 if (system_monitor) | 67 if (system_monitor) |
| 68 system_monitor->RemoveObserver(this); | 68 system_monitor->RemoveObserver(this); |
| 69 | 69 |
| 70 // Destroy all profiles that we're keeping track of. | 70 // Destroy all profiles that we're keeping track of. |
| 71 for (const_iterator i(begin()); i != end(); ++i) | 71 for (const_iterator i(begin()); i != end(); ++i) |
| 72 delete *i; | 72 delete *i; |
| 73 profiles_.clear(); | 73 profiles_.clear(); |
| 74 | |
| 75 // Get rid of available profile list | |
| 76 for (AvailableProfileVector::const_iterator i(available_profiles_.begin()); | |
| 77 i != available_profiles_.end(); ++i) | |
| 78 delete *i; | |
| 79 available_profiles_.clear(); | |
| 80 } | 74 } |
| 81 | 75 |
| 82 FilePath ProfileManager::GetDefaultProfileDir( | 76 FilePath ProfileManager::GetDefaultProfileDir( |
| 83 const FilePath& user_data_dir) { | 77 const FilePath& user_data_dir) { |
| 84 FilePath default_profile_dir(user_data_dir); | 78 FilePath default_profile_dir(user_data_dir); |
| 85 default_profile_dir = default_profile_dir.Append( | 79 default_profile_dir = default_profile_dir.Append( |
| 86 FilePath::FromWStringHack(chrome::kNotSignedInProfile)); | 80 FilePath::FromWStringHack(chrome::kNotSignedInProfile)); |
| 87 return default_profile_dir; | 81 return default_profile_dir; |
| 88 } | 82 } |
| 89 | 83 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 if (!file_util::PathExists(path)) { | 272 if (!file_util::PathExists(path)) { |
| 279 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the | 273 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the |
| 280 // profile directory. We should eventually be able to run in this | 274 // profile directory. We should eventually be able to run in this |
| 281 // situation. | 275 // situation. |
| 282 if (!file_util::CreateDirectory(path)) | 276 if (!file_util::CreateDirectory(path)) |
| 283 return NULL; | 277 return NULL; |
| 284 } | 278 } |
| 285 | 279 |
| 286 return Profile::CreateProfile(path); | 280 return Profile::CreateProfile(path); |
| 287 } | 281 } |
| OLD | NEW |