| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" | 31 #include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" |
| 32 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
| 33 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
| 34 #include "chrome/common/chrome_paths_internal.h" | 34 #include "chrome/common/chrome_paths_internal.h" |
| 35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
| 36 #include "chrome/common/logging_chrome.h" | 36 #include "chrome/common/logging_chrome.h" |
| 37 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
| 38 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
| 39 #include "components/user_prefs/user_prefs.h" |
| 40 #include "components/user_prefs/user_prefs_delegate.h" |
| 39 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/user_metrics.h" | 43 #include "content/public/browser/user_metrics.h" |
| 42 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
| 43 #include "net/http/http_transaction_factory.h" | 45 #include "net/http/http_transaction_factory.h" |
| 44 #include "net/url_request/url_request_context.h" | 46 #include "net/url_request/url_request_context.h" |
| 45 #include "net/url_request/url_request_context_getter.h" | 47 #include "net/url_request/url_request_context_getter.h" |
| 46 #include "net/url_request/url_request_job.h" | 48 #include "net/url_request/url_request_job.h" |
| 47 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
| 48 | 50 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 bool is_mounted) { | 166 bool is_mounted) { |
| 165 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { | 167 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { |
| 166 LOG(ERROR) << "IsMounted call failed."; | 168 LOG(ERROR) << "IsMounted call failed."; |
| 167 return; | 169 return; |
| 168 } | 170 } |
| 169 if (!is_mounted) | 171 if (!is_mounted) |
| 170 LOG(ERROR) << "Cryptohome is not mounted."; | 172 LOG(ERROR) << "Cryptohome is not mounted."; |
| 171 } | 173 } |
| 172 #endif | 174 #endif |
| 173 | 175 |
| 176 class ChromeUserPrefsDelegate : public components::UserPrefsDelegate { |
| 177 public: |
| 178 ChromeUserPrefsDelegate() {} |
| 179 virtual ~ChromeUserPrefsDelegate() {} |
| 180 |
| 181 virtual PrefService* PrefServiceFromBrowserContext( |
| 182 content::BrowserContext* context) OVERRIDE { |
| 183 return static_cast<Profile*>(context)->GetPrefs(); |
| 184 } |
| 185 |
| 186 private: |
| 187 DISALLOW_COPY_AND_ASSIGN(ChromeUserPrefsDelegate); |
| 188 }; |
| 189 |
| 174 } // namespace | 190 } // namespace |
| 175 | 191 |
| 176 #if defined(ENABLE_SESSION_SERVICE) | 192 #if defined(ENABLE_SESSION_SERVICE) |
| 177 // static | 193 // static |
| 178 void ProfileManager::ShutdownSessionServices() { | 194 void ProfileManager::ShutdownSessionServices() { |
| 179 ProfileManager* pm = g_browser_process->profile_manager(); | 195 ProfileManager* pm = g_browser_process->profile_manager(); |
| 180 if (!pm) // Is NULL when running unit tests. | 196 if (!pm) // Is NULL when running unit tests. |
| 181 return; | 197 return; |
| 182 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); | 198 std::vector<Profile*> profiles(pm->GetLoadedProfiles()); |
| 183 for (size_t i = 0; i < profiles.size(); ++i) | 199 for (size_t i = 0; i < profiles.size(); ++i) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 276 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
| 261 content::NotificationService::AllSources()); | 277 content::NotificationService::AllSources()); |
| 262 registrar_.Add( | 278 registrar_.Add( |
| 263 this, | 279 this, |
| 264 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, | 280 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, |
| 265 content::NotificationService::AllSources()); | 281 content::NotificationService::AllSources()); |
| 266 | 282 |
| 267 if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir.empty()) | 283 if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir.empty()) |
| 268 profile_shortcut_manager_.reset(ProfileShortcutManager::Create( | 284 profile_shortcut_manager_.reset(ProfileShortcutManager::Create( |
| 269 this)); | 285 this)); |
| 286 |
| 287 components::UserPrefs::GetInstance()->Initialize( |
| 288 scoped_ptr<components::UserPrefsDelegate>( |
| 289 new ChromeUserPrefsDelegate).Pass()); |
| 270 } | 290 } |
| 271 | 291 |
| 272 ProfileManager::~ProfileManager() { | 292 ProfileManager::~ProfileManager() { |
| 273 } | 293 } |
| 274 | 294 |
| 275 base::FilePath ProfileManager::GetDefaultProfileDir( | 295 base::FilePath ProfileManager::GetDefaultProfileDir( |
| 276 const base::FilePath& user_data_dir) { | 296 const base::FilePath& user_data_dir) { |
| 277 base::FilePath default_profile_dir(user_data_dir); | 297 base::FilePath default_profile_dir(user_data_dir); |
| 278 default_profile_dir = | 298 default_profile_dir = |
| 279 default_profile_dir.AppendASCII(chrome::kInitialProfile); | 299 default_profile_dir.AppendASCII(chrome::kInitialProfile); |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 ProfileManager::ProfileInfo::ProfileInfo( | 1126 ProfileManager::ProfileInfo::ProfileInfo( |
| 1107 Profile* profile, | 1127 Profile* profile, |
| 1108 bool created) | 1128 bool created) |
| 1109 : profile(profile), | 1129 : profile(profile), |
| 1110 created(created) { | 1130 created(created) { |
| 1111 } | 1131 } |
| 1112 | 1132 |
| 1113 ProfileManager::ProfileInfo::~ProfileInfo() { | 1133 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1114 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1134 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1115 } | 1135 } |
| OLD | NEW |