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 "chrome/browser/profile_impl.h" | 5 #include "chrome/browser/profile_impl.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 created_web_data_service_(false), | 258 created_web_data_service_(false), |
259 created_password_store_(false), | 259 created_password_store_(false), |
260 created_download_manager_(false), | 260 created_download_manager_(false), |
261 created_theme_provider_(false), | 261 created_theme_provider_(false), |
262 start_time_(Time::Now()), | 262 start_time_(Time::Now()), |
263 spellcheck_host_(NULL), | 263 spellcheck_host_(NULL), |
264 spellcheck_host_ready_(false), | 264 spellcheck_host_ready_(false), |
265 #if defined(OS_WIN) | 265 #if defined(OS_WIN) |
266 checked_instant_promo_(false), | 266 checked_instant_promo_(false), |
267 #endif | 267 #endif |
268 shutdown_session_service_(false) { | 268 shutdown_session_service_(false), |
269 tmp_extension_prefs_(NULL) { | |
269 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << | 270 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
270 "profile files to the root directory!"; | 271 "profile files to the root directory!"; |
271 create_session_service_timer_.Start( | 272 create_session_service_timer_.Start( |
272 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 273 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
273 &ProfileImpl::EnsureSessionServiceCreated); | 274 &ProfileImpl::EnsureSessionServiceCreated); |
274 | 275 |
275 PrefService* prefs = GetPrefs(); | 276 PrefService* prefs = GetPrefs(); |
276 pref_change_registrar_.Init(prefs); | 277 pref_change_registrar_.Init(prefs); |
277 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 278 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
278 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 279 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
279 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); | 280 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); |
280 | 281 |
282 // Ensure that preferences set by extensions are restored in the profile | |
283 // as early as possible. The constructor takes care of that. | |
284 tmp_extension_prefs_.reset(new ExtensionPrefs( | |
Aaron Boodman
2010/11/23 20:35:13
I think it is OK for profile to just own Extension
battre (please use the other)
2010/11/30 17:46:53
Done.
| |
285 GetPrefs(), | |
286 GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName))); | |
287 | |
281 // Convert active labs into switches. Modifies the current command line. | 288 // Convert active labs into switches. Modifies the current command line. |
282 about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); | 289 about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); |
283 | 290 |
284 #if defined(OS_MACOSX) | 291 #if defined(OS_MACOSX) |
285 // If the profile directory doesn't already have a cache directory and it | 292 // If the profile directory doesn't already have a cache directory and it |
286 // is under ~/Library/Application Support, use a suitable cache directory | 293 // is under ~/Library/Application Support, use a suitable cache directory |
287 // under ~/Library/Caches. For example, a profile directory of | 294 // under ~/Library/Caches. For example, a profile directory of |
288 // ~/Library/Application Support/Google/Chrome/MyProfileName that doesn't | 295 // ~/Library/Application Support/Google/Chrome/MyProfileName that doesn't |
289 // have a "Cache" or "MediaCache" subdirectory would use the cache directory | 296 // have a "Cache" or "MediaCache" subdirectory would use the cache directory |
290 // ~/Library/Caches/Google/Chrome/MyProfileName. | 297 // ~/Library/Caches/Google/Chrome/MyProfileName. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 | 387 |
381 FilePath script_dir; // Don't look for user scripts in any directory. | 388 FilePath script_dir; // Don't look for user scripts in any directory. |
382 // TODO(aa): We should just remove this functionality, | 389 // TODO(aa): We should just remove this functionality, |
383 // since it isn't used anymore. | 390 // since it isn't used anymore. |
384 user_script_master_ = new UserScriptMaster(script_dir, this); | 391 user_script_master_ = new UserScriptMaster(script_dir, this); |
385 | 392 |
386 extensions_service_ = new ExtensionsService( | 393 extensions_service_ = new ExtensionsService( |
387 this, | 394 this, |
388 CommandLine::ForCurrentProcess(), | 395 CommandLine::ForCurrentProcess(), |
389 GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName), | 396 GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName), |
397 tmp_extension_prefs_.release(), | |
390 true); | 398 true); |
391 | 399 |
392 RegisterComponentExtensions(); | 400 RegisterComponentExtensions(); |
393 extensions_service_->Init(); | 401 extensions_service_->Init(); |
394 InstallDefaultApps(); | 402 InstallDefaultApps(); |
395 | 403 |
396 // Load any extensions specified with --load-extension. | 404 // Load any extensions specified with --load-extension. |
397 if (command_line->HasSwitch(switches::kLoadExtension)) { | 405 if (command_line->HasSwitch(switches::kLoadExtension)) { |
398 FilePath path = command_line->GetSwitchValuePath(switches::kLoadExtension); | 406 FilePath path = command_line->GetSwitchValuePath(switches::kLoadExtension); |
399 extensions_service_->LoadExtension(path); | 407 extensions_service_->LoadExtension(path); |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1364 #if defined(OS_CHROMEOS) | 1372 #if defined(OS_CHROMEOS) |
1365 chromeos::ProxyConfigServiceImpl* | 1373 chromeos::ProxyConfigServiceImpl* |
1366 ProfileImpl::GetChromeOSProxyConfigServiceImpl() { | 1374 ProfileImpl::GetChromeOSProxyConfigServiceImpl() { |
1367 if (!chromeos_proxy_config_service_impl_) { | 1375 if (!chromeos_proxy_config_service_impl_) { |
1368 chromeos_proxy_config_service_impl_ = | 1376 chromeos_proxy_config_service_impl_ = |
1369 new chromeos::ProxyConfigServiceImpl(); | 1377 new chromeos::ProxyConfigServiceImpl(); |
1370 } | 1378 } |
1371 return chromeos_proxy_config_service_impl_; | 1379 return chromeos_proxy_config_service_impl_; |
1372 } | 1380 } |
1373 #endif // defined(OS_CHROMEOS) | 1381 #endif // defined(OS_CHROMEOS) |
OLD | NEW |