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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "net/url_request/url_request_job_tracker.h" | 32 #include "net/url_request/url_request_job_tracker.h" |
33 | 33 |
34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
35 #include "chrome/browser/chromeos/cros/cros_library.h" | 35 #include "chrome/browser/chromeos/cros/cros_library.h" |
36 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 36 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
37 #endif | 37 #endif |
38 | 38 |
39 // static | 39 // static |
40 void ProfileManager::ShutdownSessionServices() { | 40 void ProfileManager::ShutdownSessionServices() { |
41 ProfileManager* pm = g_browser_process->profile_manager(); | 41 ProfileManager* pm = g_browser_process->profile_manager(); |
| 42 if (!pm) // Is NULL when running unit tests. |
| 43 return; |
42 for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) | 44 for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) |
43 (*i)->ShutdownSessionService(); | 45 (*i)->ShutdownSessionService(); |
44 } | 46 } |
45 | 47 |
46 // static | 48 // static |
47 Profile* ProfileManager::GetDefaultProfile() { | 49 Profile* ProfileManager::GetDefaultProfile() { |
48 FilePath user_data_dir; | 50 FilePath user_data_dir; |
49 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 51 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
50 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 52 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
51 return profile_manager->GetDefaultProfile(user_data_dir); | 53 return profile_manager->GetDefaultProfile(user_data_dir); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 if (!file_util::PathExists(path)) { | 286 if (!file_util::PathExists(path)) { |
285 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the | 287 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the |
286 // profile directory. We should eventually be able to run in this | 288 // profile directory. We should eventually be able to run in this |
287 // situation. | 289 // situation. |
288 if (!file_util::CreateDirectory(path)) | 290 if (!file_util::CreateDirectory(path)) |
289 return NULL; | 291 return NULL; |
290 } | 292 } |
291 | 293 |
292 return Profile::CreateProfile(path); | 294 return Profile::CreateProfile(path); |
293 } | 295 } |
OLD | NEW |