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/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_util.h" | 10 #include "base/file_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // static | 45 // static |
46 Profile* ProfileManager::GetDefaultProfile() { | 46 Profile* ProfileManager::GetDefaultProfile() { |
47 FilePath user_data_dir; | 47 FilePath user_data_dir; |
48 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 48 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
49 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 49 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
50 return profile_manager->GetDefaultProfile(user_data_dir); | 50 return profile_manager->GetDefaultProfile(user_data_dir); |
51 } | 51 } |
52 | 52 |
53 ProfileManager::ProfileManager() : logged_in_(false) { | 53 ProfileManager::ProfileManager() : logged_in_(false) { |
54 SystemMonitor::Get()->AddObserver(this); | 54 ui::SystemMonitor::Get()->AddObserver(this); |
55 #if defined(OS_CHROMEOS) | 55 #if defined(OS_CHROMEOS) |
56 registrar_.Add( | 56 registrar_.Add( |
57 this, | 57 this, |
58 NotificationType::LOGIN_USER_CHANGED, | 58 NotificationType::LOGIN_USER_CHANGED, |
59 NotificationService::AllSources()); | 59 NotificationService::AllSources()); |
60 #endif | 60 #endif |
61 } | 61 } |
62 | 62 |
63 ProfileManager::~ProfileManager() { | 63 ProfileManager::~ProfileManager() { |
64 SystemMonitor* system_monitor = SystemMonitor::Get(); | 64 ui::SystemMonitor* system_monitor = ui::SystemMonitor::Get(); |
65 if (system_monitor) | 65 if (system_monitor) |
66 system_monitor->RemoveObserver(this); | 66 system_monitor->RemoveObserver(this); |
67 | 67 |
68 // Destroy all profiles that we're keeping track of. | 68 // Destroy all profiles that we're keeping track of. |
69 for (const_iterator i(begin()); i != end(); ++i) | 69 for (const_iterator i(begin()); i != end(); ++i) |
70 delete *i; | 70 delete *i; |
71 profiles_.clear(); | 71 profiles_.clear(); |
72 } | 72 } |
73 | 73 |
74 FilePath ProfileManager::GetDefaultProfileDir( | 74 FilePath ProfileManager::GetDefaultProfileDir( |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 if (!file_util::PathExists(path)) { | 274 if (!file_util::PathExists(path)) { |
275 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the | 275 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the |
276 // profile directory. We should eventually be able to run in this | 276 // profile directory. We should eventually be able to run in this |
277 // situation. | 277 // situation. |
278 if (!file_util::CreateDirectory(path)) | 278 if (!file_util::CreateDirectory(path)) |
279 return NULL; | 279 return NULL; |
280 } | 280 } |
281 | 281 |
282 return Profile::CreateProfile(path); | 282 return Profile::CreateProfile(path); |
283 } | 283 } |
OLD | NEW |