| 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" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browser_thread.h" | 14 #include "chrome/browser/browser_thread.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/logging_chrome.h" | 22 #include "chrome/common/logging_chrome.h" |
| 23 #include "chrome/common/net/url_request_context_getter.h" | 23 #include "chrome/common/net/url_request_context_getter.h" |
| 24 #include "chrome/common/notification_service.h" | 24 #include "chrome/common/notification_service.h" |
| 25 #include "chrome/common/notification_type.h" | 25 #include "chrome/common/notification_type.h" |
| 26 #include "chrome/common/pref_names.h" | |
| 27 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 28 #include "net/http/http_transaction_factory.h" | 27 #include "net/http/http_transaction_factory.h" |
| 29 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
| 30 #include "net/url_request/url_request_job.h" | 29 #include "net/url_request/url_request_job.h" |
| 31 #include "net/url_request/url_request_job_tracker.h" | 30 #include "net/url_request/url_request_job_tracker.h" |
| 32 | 31 |
| 33 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
| 34 #include "chrome/browser/chromeos/cros/cros_library.h" | 33 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 35 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 34 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
| 36 #endif | 35 #endif |
| 37 | 36 |
| 38 // static | 37 // static |
| 39 void ProfileManager::ShutdownSessionServices() { | 38 void ProfileManager::ShutdownSessionServices() { |
| 40 ProfileManager* pm = g_browser_process->profile_manager(); | 39 ProfileManager* pm = g_browser_process->profile_manager(); |
| 41 if (!pm) // Is NULL when running unit tests. | 40 if (!pm) // Is NULL when running unit tests. |
| 42 return; | 41 return; |
| 43 for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) | 42 for (ProfileManager::const_iterator i = pm->begin(); i != pm->end(); ++i) |
| 44 (*i)->ShutdownSessionService(); | 43 (*i)->ShutdownSessionService(); |
| 45 } | 44 } |
| 46 | 45 |
| 47 // static | 46 // static |
| 48 Profile* ProfileManager::GetDefaultProfile() { | 47 Profile* ProfileManager::GetDefaultProfile() { |
| 49 FilePath user_data_dir; | 48 FilePath user_data_dir; |
| 50 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 49 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
| 51 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 50 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 if (!file_util::PathExists(path)) { | 275 if (!file_util::PathExists(path)) { |
| 277 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the | 276 // TODO(tc): http://b/1094718 Bad things happen if we can't write to the |
| 278 // profile directory. We should eventually be able to run in this | 277 // profile directory. We should eventually be able to run in this |
| 279 // situation. | 278 // situation. |
| 280 if (!file_util::CreateDirectory(path)) | 279 if (!file_util::CreateDirectory(path)) |
| 281 return NULL; | 280 return NULL; |
| 282 } | 281 } |
| 283 | 282 |
| 284 return Profile::CreateProfile(path); | 283 return Profile::CreateProfile(path); |
| 285 } | 284 } |
| OLD | NEW |