| 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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 269 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
| 270 &ProfileImpl::EnsureSessionServiceCreated); | 270 &ProfileImpl::EnsureSessionServiceCreated); |
| 271 | 271 |
| 272 PrefService* prefs = GetPrefs(); | 272 PrefService* prefs = GetPrefs(); |
| 273 pref_change_registrar_.Init(prefs); | 273 pref_change_registrar_.Init(prefs); |
| 274 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); | 274 pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); |
| 275 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); | 275 pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); |
| 276 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); | 276 pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); |
| 277 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); | 277 pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); |
| 278 | 278 |
| 279 // Ensure that preferences set by extensions are restored in the profile |
| 280 // as early as possible. The constructor takes care of that. |
| 281 extension_prefs_.reset(new ExtensionPrefs( |
| 282 GetPrefs(), |
| 283 GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName))); |
| 284 |
| 279 // Convert active labs into switches. Modifies the current command line. | 285 // Convert active labs into switches. Modifies the current command line. |
| 280 about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); | 286 about_flags::ConvertFlagsToSwitches(prefs, CommandLine::ForCurrentProcess()); |
| 281 | 287 |
| 282 // It would be nice to use PathService for fetching this directory, but | 288 // It would be nice to use PathService for fetching this directory, but |
| 283 // the cache directory depends on the profile directory, which isn't available | 289 // the cache directory depends on the profile directory, which isn't available |
| 284 // to PathService. | 290 // to PathService. |
| 285 chrome::GetUserCacheDirectory(path_, &base_cache_path_); | 291 chrome::GetUserCacheDirectory(path_, &base_cache_path_); |
| 286 file_util::CreateDirectory(base_cache_path_); | 292 file_util::CreateDirectory(base_cache_path_); |
| 287 | 293 |
| 288 // Listen for theme installations from our original profile. | 294 // Listen for theme installations from our original profile. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 | 353 |
| 348 FilePath script_dir; // Don't look for user scripts in any directory. | 354 FilePath script_dir; // Don't look for user scripts in any directory. |
| 349 // TODO(aa): We should just remove this functionality, | 355 // TODO(aa): We should just remove this functionality, |
| 350 // since it isn't used anymore. | 356 // since it isn't used anymore. |
| 351 user_script_master_ = new UserScriptMaster(script_dir, this); | 357 user_script_master_ = new UserScriptMaster(script_dir, this); |
| 352 | 358 |
| 353 extensions_service_ = new ExtensionsService( | 359 extensions_service_ = new ExtensionsService( |
| 354 this, | 360 this, |
| 355 CommandLine::ForCurrentProcess(), | 361 CommandLine::ForCurrentProcess(), |
| 356 GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName), | 362 GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName), |
| 363 extension_prefs_.get(), |
| 357 true); | 364 true); |
| 358 | 365 |
| 359 RegisterComponentExtensions(); | 366 RegisterComponentExtensions(); |
| 360 extensions_service_->Init(); | 367 extensions_service_->Init(); |
| 361 InstallDefaultApps(); | 368 InstallDefaultApps(); |
| 362 | 369 |
| 363 // Load any extensions specified with --load-extension. | 370 // Load any extensions specified with --load-extension. |
| 364 if (command_line->HasSwitch(switches::kLoadExtension)) { | 371 if (command_line->HasSwitch(switches::kLoadExtension)) { |
| 365 FilePath path = command_line->GetSwitchValuePath(switches::kLoadExtension); | 372 FilePath path = command_line->GetSwitchValuePath(switches::kLoadExtension); |
| 366 extensions_service_->LoadExtension(path); | 373 extensions_service_->LoadExtension(path); |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 new chromeos::EnterpriseExtensionObserver(this)); | 1345 new chromeos::EnterpriseExtensionObserver(this)); |
| 1339 } | 1346 } |
| 1340 #endif // defined(OS_CHROMEOS) | 1347 #endif // defined(OS_CHROMEOS) |
| 1341 | 1348 |
| 1342 PrefProxyConfigTracker* ProfileImpl::GetProxyConfigTracker() { | 1349 PrefProxyConfigTracker* ProfileImpl::GetProxyConfigTracker() { |
| 1343 if (!pref_proxy_config_tracker_) | 1350 if (!pref_proxy_config_tracker_) |
| 1344 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs()); | 1351 pref_proxy_config_tracker_ = new PrefProxyConfigTracker(GetPrefs()); |
| 1345 | 1352 |
| 1346 return pref_proxy_config_tracker_; | 1353 return pref_proxy_config_tracker_; |
| 1347 } | 1354 } |
| OLD | NEW |