Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/environment.h" | 10 #include "base/environment.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/string_tokenizer.h" | |
| 15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 18 #include "chrome/browser/autocomplete/network_action_predictor.h" | 19 #include "chrome/browser/autocomplete/network_action_predictor.h" |
| 19 #include "chrome/browser/autofill/personal_data_manager.h" | 20 #include "chrome/browser/autofill/personal_data_manager.h" |
| 20 #include "chrome/browser/background/background_contents_service_factory.h" | 21 #include "chrome/browser/background/background_contents_service_factory.h" |
| 21 #include "chrome/browser/background/background_mode_manager.h" | 22 #include "chrome/browser/background/background_mode_manager.h" |
| 22 #include "chrome/browser/bookmarks/bookmark_model.h" | 23 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browsing_data_remover.h" | 25 #include "chrome/browser/browsing_data_remover.h" |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 // Creation has been finished. | 392 // Creation has been finished. |
| 392 if (delegate_) | 393 if (delegate_) |
| 393 delegate_->OnProfileCreated(this, true); | 394 delegate_->OnProfileCreated(this, true); |
| 394 | 395 |
| 395 content::NotificationService::current()->Notify( | 396 content::NotificationService::current()->Notify( |
| 396 chrome::NOTIFICATION_PROFILE_CREATED, | 397 chrome::NOTIFICATION_PROFILE_CREATED, |
| 397 content::Source<Profile>(this), | 398 content::Source<Profile>(this), |
| 398 content::NotificationService::NoDetails()); | 399 content::NotificationService::NoDetails()); |
| 399 } | 400 } |
| 400 | 401 |
| 402 static void AddOrReplaceComponentExtension(extensions::ComponentLoader* loader, | |
|
Aaron Boodman
2011/12/06 19:43:35
Why did you pull this out into a function? It's no
SeRya
2011/12/06 22:19:37
Reverted this change.
| |
| 403 FilePath const& path) { | |
| 404 // Load the component extension manifest synchronously. | |
| 405 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
|
Aaron Boodman
2011/12/06 19:43:35
This is still making me nervous. Since you are alr
SeRya
2011/12/06 22:19:37
I will try to figure out why it did work, but the
| |
| 406 loader->AddOrReplace(path); | |
| 407 } | |
| 408 | |
| 401 void ProfileImpl::InitExtensions(bool extensions_enabled) { | 409 void ProfileImpl::InitExtensions(bool extensions_enabled) { |
| 402 if (user_script_master_ || extension_service_.get()) | 410 if (user_script_master_ || extension_service_.get()) |
| 403 return; // Already initialized. | 411 return; // Already initialized. |
| 404 | 412 |
| 405 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 413 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 406 if (command_line->HasSwitch( | 414 if (command_line->HasSwitch( |
| 407 switches::kEnableExtensionTimelineApi)) { | 415 switches::kEnableExtensionTimelineApi)) { |
| 408 extension_devtools_manager_ = new ExtensionDevToolsManager(this); | 416 extension_devtools_manager_ = new ExtensionDevToolsManager(this); |
| 409 } | 417 } |
| 410 | 418 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 429 #endif | 437 #endif |
| 430 extension_service_.reset(new ExtensionService( | 438 extension_service_.reset(new ExtensionService( |
| 431 this, | 439 this, |
| 432 CommandLine::ForCurrentProcess(), | 440 CommandLine::ForCurrentProcess(), |
| 433 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | 441 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), |
| 434 extension_prefs_.get(), | 442 extension_prefs_.get(), |
| 435 autoupdate_enabled, | 443 autoupdate_enabled, |
| 436 extensions_enabled)); | 444 extensions_enabled)); |
| 437 | 445 |
| 438 extension_service_->component_loader()->AddDefaultComponentExtensions(); | 446 extension_service_->component_loader()->AddDefaultComponentExtensions(); |
| 447 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { | |
| 448 CommandLine::StringType path_list = command_line->GetSwitchValueNative( | |
| 449 switches::kLoadComponentExtension); | |
| 450 StringTokenizerT<CommandLine::StringType, | |
| 451 CommandLine::StringType::const_iterator> t(path_list, | |
| 452 FILE_PATH_LITERAL(",")); | |
| 453 while (t.GetNext()) { | |
| 454 AddOrReplaceComponentExtension( | |
| 455 extension_service_->component_loader(), FilePath(t.token())); | |
| 456 } | |
| 457 } | |
| 439 extension_service_->Init(); | 458 extension_service_->Init(); |
| 440 | 459 |
| 441 if (extensions_enabled) { | 460 if (extensions_enabled) { |
| 442 // Load any extensions specified with --load-extension. | 461 // Load any extensions specified with --load-extension. |
| 443 // TODO(yoz): Seems like this should move into ExtensionService::Init. | 462 // TODO(yoz): Seems like this should move into ExtensionService::Init. |
| 444 if (command_line->HasSwitch(switches::kLoadExtension)) { | 463 if (command_line->HasSwitch(switches::kLoadExtension)) { |
| 445 FilePath path = command_line->GetSwitchValuePath( | 464 FilePath path = command_line->GetSwitchValuePath( |
| 446 switches::kLoadExtension); | 465 switches::kLoadExtension); |
| 447 extensions::UnpackedInstaller::Create(extension_service_.get())-> | 466 extensions::UnpackedInstaller::Create(extension_service_.get())-> |
| 448 LoadFromCommandLine(path); | 467 LoadFromCommandLine(path); |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1616 FilePath* cache_path, | 1635 FilePath* cache_path, |
| 1617 int* max_size) { | 1636 int* max_size) { |
| 1618 DCHECK(cache_path); | 1637 DCHECK(cache_path); |
| 1619 DCHECK(max_size); | 1638 DCHECK(max_size); |
| 1620 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1639 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1621 if (!path.empty()) | 1640 if (!path.empty()) |
| 1622 *cache_path = path; | 1641 *cache_path = path; |
| 1623 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1642 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1624 prefs_->GetInteger(prefs::kDiskCacheSize); | 1643 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1625 } | 1644 } |
| OLD | NEW |