Chromium Code Reviews| 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 "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" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "chrome/browser/bookmarks/bookmark_model.h" | 23 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/browsing_data_remover.h" | 25 #include "chrome/browser/browsing_data_remover.h" |
| 26 #include "chrome/browser/chrome_plugin_service_filter.h" | 26 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 27 #include "chrome/browser/content_settings/cookie_settings.h" | 27 #include "chrome/browser/content_settings/cookie_settings.h" |
| 28 #include "chrome/browser/content_settings/host_content_settings_map.h" | 28 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 29 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 30 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
| 31 #include "chrome/browser/download/download_service.h" | 31 #include "chrome/browser/download/download_service.h" |
| 32 #include "chrome/browser/download/download_service_factory.h" | 32 #include "chrome/browser/download/download_service_factory.h" |
| 33 #include "chrome/browser/extensions/component_loader.h" | |
| 34 #include "chrome/browser/extensions/extension_devtools_manager.h" | |
| 35 #include "chrome/browser/extensions/extension_error_reporter.h" | |
| 36 #include "chrome/browser/extensions/extension_event_router.h" | 33 #include "chrome/browser/extensions/extension_event_router.h" |
| 37 #include "chrome/browser/extensions/extension_info_map.h" | |
| 38 #include "chrome/browser/extensions/extension_message_service.h" | |
| 39 #include "chrome/browser/extensions/extension_navigation_observer.h" | |
| 40 #include "chrome/browser/extensions/extension_pref_store.h" | 34 #include "chrome/browser/extensions/extension_pref_store.h" |
| 35 #include "chrome/browser/extensions/extension_pref_value_map.h" | |
| 41 #include "chrome/browser/extensions/extension_process_manager.h" | 36 #include "chrome/browser/extensions/extension_process_manager.h" |
| 42 #include "chrome/browser/extensions/extension_service.h" | 37 #include "chrome/browser/extensions/extension_service.h" |
| 43 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 38 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 44 #include "chrome/browser/extensions/unpacked_installer.h" | 39 #include "chrome/browser/extensions/extension_system.h" |
| 40 #include "chrome/browser/extensions/extension_system_factory.h" | |
| 45 #include "chrome/browser/extensions/user_script_master.h" | 41 #include "chrome/browser/extensions/user_script_master.h" |
| 46 #include "chrome/browser/favicon/favicon_service.h" | 42 #include "chrome/browser/favicon/favicon_service.h" |
| 47 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" | 43 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 48 #include "chrome/browser/history/history.h" | 44 #include "chrome/browser/history/history.h" |
| 49 #include "chrome/browser/history/shortcuts_backend.h" | 45 #include "chrome/browser/history/shortcuts_backend.h" |
| 50 #include "chrome/browser/history/top_sites.h" | 46 #include "chrome/browser/history/top_sites.h" |
| 51 #include "chrome/browser/instant/instant_controller.h" | 47 #include "chrome/browser/instant/instant_controller.h" |
| 52 #include "chrome/browser/metrics/metrics_service.h" | 48 #include "chrome/browser/metrics/metrics_service.h" |
| 53 #include "chrome/browser/net/chrome_url_request_context.h" | 49 #include "chrome/browser/net/chrome_url_request_context.h" |
| 54 #include "chrome/browser/net/net_pref_observer.h" | 50 #include "chrome/browser/net/net_pref_observer.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 242 PasswordStoreX::RegisterUserPrefs(prefs); | 238 PasswordStoreX::RegisterUserPrefs(prefs); |
| 243 #endif | 239 #endif |
| 244 } | 240 } |
| 245 | 241 |
| 246 ProfileImpl::ProfileImpl(const FilePath& path, | 242 ProfileImpl::ProfileImpl(const FilePath& path, |
| 247 Profile::Delegate* delegate) | 243 Profile::Delegate* delegate) |
| 248 : path_(path), | 244 : path_(path), |
| 249 ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( | 245 ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( |
| 250 new VisitedLinkEventListener(this))), | 246 new VisitedLinkEventListener(this))), |
| 251 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), | 247 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), |
| 252 extension_devtools_manager_(NULL), | |
| 253 host_content_settings_map_(NULL), | 248 host_content_settings_map_(NULL), |
| 254 host_zoom_map_(NULL), | 249 host_zoom_map_(NULL), |
| 255 history_service_created_(false), | 250 history_service_created_(false), |
| 256 favicon_service_created_(false), | 251 favicon_service_created_(false), |
| 257 created_web_data_service_(false), | 252 created_web_data_service_(false), |
| 258 created_password_store_(false), | 253 created_password_store_(false), |
| 259 start_time_(Time::Now()), | 254 start_time_(Time::Now()), |
| 260 #if defined(OS_WIN) | 255 #if defined(OS_WIN) |
| 261 checked_instant_promo_(false), | 256 checked_instant_promo_(false), |
| 262 #endif | 257 #endif |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 // Creation has been finished. | 409 // Creation has been finished. |
| 415 if (delegate_) | 410 if (delegate_) |
| 416 delegate_->OnProfileCreated(this, true); | 411 delegate_->OnProfileCreated(this, true); |
| 417 | 412 |
| 418 content::NotificationService::current()->Notify( | 413 content::NotificationService::current()->Notify( |
| 419 chrome::NOTIFICATION_PROFILE_CREATED, | 414 chrome::NOTIFICATION_PROFILE_CREATED, |
| 420 content::Source<Profile>(this), | 415 content::Source<Profile>(this), |
| 421 content::NotificationService::NoDetails()); | 416 content::NotificationService::NoDetails()); |
| 422 } | 417 } |
| 423 | 418 |
| 424 void ProfileImpl::InitExtensions(bool extensions_enabled) { | |
| 425 if (user_script_master_ || extension_service_.get()) | |
| 426 return; // Already initialized. | |
| 427 | |
| 428 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 429 if (command_line->HasSwitch( | |
| 430 switches::kEnableExtensionTimelineApi)) { | |
| 431 extension_devtools_manager_ = new ExtensionDevToolsManager(this); | |
| 432 } | |
| 433 | |
| 434 // The ExtensionInfoMap needs to be created before the | |
| 435 // ExtensionProcessManager. | |
| 436 extension_info_map_ = new ExtensionInfoMap(); | |
| 437 extension_process_manager_.reset(ExtensionProcessManager::Create(this)); | |
| 438 extension_event_router_.reset(new ExtensionEventRouter(this)); | |
| 439 extension_message_service_ = new ExtensionMessageService(this); | |
| 440 extension_navigation_observer_.reset(new ExtensionNavigationObserver(this)); | |
| 441 | |
| 442 ExtensionErrorReporter::Init(true); // allow noisy errors. | |
| 443 | |
| 444 user_script_master_ = new UserScriptMaster(this); | |
| 445 | |
| 446 bool autoupdate_enabled = true; | |
| 447 #if defined(OS_CHROMEOS) | |
| 448 if (!extensions_enabled) | |
| 449 autoupdate_enabled = false; | |
| 450 else | |
| 451 autoupdate_enabled = !command_line->HasSwitch(switches::kGuestSession); | |
| 452 #endif | |
| 453 extension_service_.reset(new ExtensionService( | |
| 454 this, | |
| 455 CommandLine::ForCurrentProcess(), | |
| 456 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | |
| 457 extension_prefs_.get(), | |
| 458 autoupdate_enabled, | |
| 459 extensions_enabled)); | |
| 460 | |
| 461 extension_service_->component_loader()->AddDefaultComponentExtensions(); | |
| 462 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { | |
| 463 CommandLine::StringType path_list = command_line->GetSwitchValueNative( | |
| 464 switches::kLoadComponentExtension); | |
| 465 StringTokenizerT<CommandLine::StringType, | |
| 466 CommandLine::StringType::const_iterator> t(path_list, | |
| 467 FILE_PATH_LITERAL(",")); | |
| 468 while (t.GetNext()) { | |
| 469 // Load the component extension manifest synchronously. | |
| 470 // Blocking the UI thread is acceptable here since | |
| 471 // this flag designated for developers. | |
| 472 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
| 473 extension_service_->component_loader()->AddOrReplace( | |
| 474 FilePath(t.token())); | |
| 475 } | |
| 476 } | |
| 477 extension_service_->Init(); | |
| 478 | |
| 479 if (extensions_enabled) { | |
| 480 // Load any extensions specified with --load-extension. | |
| 481 // TODO(yoz): Seems like this should move into ExtensionService::Init. | |
| 482 if (command_line->HasSwitch(switches::kLoadExtension)) { | |
| 483 CommandLine::StringType path_list = command_line->GetSwitchValueNative( | |
| 484 switches::kLoadExtension); | |
| 485 StringTokenizerT<CommandLine::StringType, | |
| 486 CommandLine::StringType::const_iterator> t(path_list, | |
| 487 FILE_PATH_LITERAL(",")); | |
| 488 scoped_refptr<extensions::UnpackedInstaller> installer = | |
| 489 extensions::UnpackedInstaller::Create(extension_service_.get()); | |
| 490 while (t.GetNext()) { | |
| 491 installer->LoadFromCommandLine(FilePath(t.token())); | |
| 492 } | |
| 493 } | |
| 494 } | |
| 495 | |
| 496 // Make the chrome://extension-icon/ resource available. | |
| 497 GetChromeURLDataManager()->AddDataSource(new ExtensionIconSource(this)); | |
| 498 | |
| 499 // Initialize extension event routers. Note that on Chrome OS, this will | |
| 500 // not succeed if the user has not logged in yet, in which case the | |
| 501 // event routers are initialized in LoginUtilsImpl::CompleteLogin instead. | |
| 502 // The InitEventRouters call used to be in BrowserMain, because when bookmark | |
| 503 // import happened on first run, the bookmark bar was not being correctly | |
| 504 // initialized (see issue 40144). Now that bookmarks aren't imported and | |
| 505 // the event routers need to be initialized for every profile individually, | |
| 506 // initialize them with the extension service. | |
| 507 // If this profile is being created as part of the import process, never | |
| 508 // initialize the event routers. If import is going to run in a separate | |
| 509 // process (the profile itself is on the main process), wait for import to | |
| 510 // finish before initializing the routers. | |
| 511 if (!command_line->HasSwitch(switches::kImport) && | |
| 512 !command_line->HasSwitch(switches::kImportFromFile)) { | |
| 513 if (g_browser_process->profile_manager()->will_import()) { | |
| 514 extension_service_->InitEventRoutersAfterImport(); | |
| 515 } else { | |
| 516 extension_service_->InitEventRouters(); | |
| 517 } | |
| 518 } | |
| 519 } | |
| 520 | |
| 521 void ProfileImpl::InitPromoResources() { | 419 void ProfileImpl::InitPromoResources() { |
| 522 if (promo_resource_service_) | 420 if (promo_resource_service_) |
| 523 return; | 421 return; |
| 524 | 422 |
| 525 promo_resource_service_ = new PromoResourceService(this); | 423 promo_resource_service_ = new PromoResourceService(this); |
| 526 promo_resource_service_->StartAfterDelay(); | 424 promo_resource_service_->StartAfterDelay(); |
| 527 } | 425 } |
| 528 | 426 |
| 529 void ProfileImpl::InitRegisteredProtocolHandlers() { | 427 void ProfileImpl::InitRegisteredProtocolHandlers() { |
| 530 if (protocol_handler_registry_) | 428 if (protocol_handler_registry_) |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 620 // HistoryService will join with HistoryService's backend thread so that | 518 // HistoryService will join with HistoryService's backend thread so that |
| 621 // by the time the destructor has finished we're sure it will no longer call | 519 // by the time the destructor has finished we're sure it will no longer call |
| 622 // into the BookmarkModel. | 520 // into the BookmarkModel. |
| 623 history_service_ = NULL; | 521 history_service_ = NULL; |
| 624 bookmark_bar_model_.reset(); | 522 bookmark_bar_model_.reset(); |
| 625 | 523 |
| 626 // FaviconService depends on HistoryServce so make sure we delete | 524 // FaviconService depends on HistoryServce so make sure we delete |
| 627 // HistoryService first. | 525 // HistoryService first. |
| 628 favicon_service_.reset(); | 526 favicon_service_.reset(); |
| 629 | 527 |
| 630 if (extension_message_service_) | |
| 631 extension_message_service_->DestroyingProfile(); | |
| 632 | |
| 633 if (pref_proxy_config_tracker_.get()) | 528 if (pref_proxy_config_tracker_.get()) |
| 634 pref_proxy_config_tracker_->DetachFromPrefService(); | 529 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 635 | 530 |
| 636 if (protocol_handler_registry_) | 531 if (protocol_handler_registry_) |
| 637 protocol_handler_registry_->Finalize(); | 532 protocol_handler_registry_->Finalize(); |
| 638 | 533 |
| 639 if (host_content_settings_map_) | 534 if (host_content_settings_map_) |
| 640 host_content_settings_map_->ShutdownOnUIThread(); | 535 host_content_settings_map_->ShutdownOnUIThread(); |
| 641 | 536 |
| 642 // This causes the Preferences file to be written to disk. | 537 // This causes the Preferences file to be written to disk. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 696 scoped_ptr<VisitedLinkMaster> visited_links( | 591 scoped_ptr<VisitedLinkMaster> visited_links( |
| 697 new VisitedLinkMaster(visited_link_event_listener_.get(), this)); | 592 new VisitedLinkMaster(visited_link_event_listener_.get(), this)); |
| 698 if (!visited_links->Init()) | 593 if (!visited_links->Init()) |
| 699 return NULL; | 594 return NULL; |
| 700 visited_link_master_.swap(visited_links); | 595 visited_link_master_.swap(visited_links); |
| 701 } | 596 } |
| 702 | 597 |
| 703 return visited_link_master_.get(); | 598 return visited_link_master_.get(); |
| 704 } | 599 } |
| 705 | 600 |
| 706 ExtensionService* ProfileImpl::GetExtensionService() { | 601 ExtensionService* ProfileImpl::GetExtensionService() { |
|
Miranda Callahan
2012/02/09 22:10:04
Will it eventually be possible to remove this meth
Yoyo Zhou
2012/02/16 21:49:20
Right, this would an even more enormous change if
| |
| 707 return extension_service_.get(); | 602 return ExtensionSystemFactory::GetForProfile(this)->extension_service(); |
| 708 } | 603 } |
| 709 | 604 |
| 710 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { | 605 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { |
| 711 return user_script_master_.get(); | 606 return ExtensionSystemFactory::GetForProfile(this)->user_script_master(); |
| 712 } | |
| 713 | |
| 714 ExtensionDevToolsManager* ProfileImpl::GetExtensionDevToolsManager() { | |
| 715 return extension_devtools_manager_.get(); | |
| 716 } | 607 } |
| 717 | 608 |
| 718 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { | 609 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { |
| 719 return extension_process_manager_.get(); | 610 return ExtensionSystemFactory::GetForProfile(this)->process_manager(); |
| 720 } | |
| 721 | |
| 722 ExtensionMessageService* ProfileImpl::GetExtensionMessageService() { | |
| 723 return extension_message_service_.get(); | |
| 724 } | 611 } |
| 725 | 612 |
| 726 ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { | 613 ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { |
| 727 return extension_event_router_.get(); | 614 return ExtensionSystemFactory::GetForProfile(this)->event_router(); |
| 728 } | 615 } |
| 729 | 616 |
| 730 ExtensionSpecialStoragePolicy* | 617 ExtensionSpecialStoragePolicy* |
| 731 ProfileImpl::GetExtensionSpecialStoragePolicy() { | 618 ProfileImpl::GetExtensionSpecialStoragePolicy() { |
| 732 if (!extension_special_storage_policy_.get()) { | 619 if (!extension_special_storage_policy_.get()) { |
| 733 extension_special_storage_policy_ = | 620 extension_special_storage_policy_ = |
| 734 new ExtensionSpecialStoragePolicy(CookieSettings::GetForProfile(this)); | 621 new ExtensionSpecialStoragePolicy(CookieSettings::GetForProfile(this)); |
| 735 } | 622 } |
| 736 return extension_special_storage_policy_.get(); | 623 return extension_special_storage_policy_.get(); |
| 737 } | 624 } |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 768 // Mark the session as open. | 655 // Mark the session as open. |
| 769 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); | 656 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); |
| 770 | 657 |
| 771 bool extensions_disabled = | 658 bool extensions_disabled = |
| 772 prefs_->GetBoolean(prefs::kDisableExtensions) || | 659 prefs_->GetBoolean(prefs::kDisableExtensions) || |
| 773 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); | 660 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); |
| 774 | 661 |
| 775 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); | 662 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); |
| 776 | 663 |
| 777 // Ensure that preferences set by extensions are restored in the profile | 664 // Ensure that preferences set by extensions are restored in the profile |
| 778 // as early as possible. The constructor takes care of that. | 665 // as early as possible. The ExtensionPrefs constructor takes care of that. |
| 779 extension_prefs_.reset(new ExtensionPrefs( | 666 ExtensionSystemFactory::GetForProfile(this)->InitPrefs( |
| 780 prefs_.get(), | 667 extensions_disabled, GetExtensionPrefValueMap()); |
|
Elliot Glaysher
2012/02/09 20:10:24
In both the OTRProfileImpl and here, you have this
Yoyo Zhou
2012/02/16 21:49:20
Good point. I think this should be possible. But I
| |
| 781 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | |
| 782 GetExtensionPrefValueMap())); | |
| 783 extension_prefs_->Init(extensions_disabled); | |
| 784 | 668 |
| 785 DCHECK(!net_pref_observer_.get()); | 669 DCHECK(!net_pref_observer_.get()); |
| 786 net_pref_observer_.reset(new NetPrefObserver( | 670 net_pref_observer_.reset(new NetPrefObserver( |
| 787 prefs_.get(), | 671 prefs_.get(), |
| 788 prerender::PrerenderManagerFactory::GetForProfile(this), | 672 prerender::PrerenderManagerFactory::GetForProfile(this), |
| 789 predictor_)); | 673 predictor_)); |
| 790 | 674 |
| 791 DoFinalInit(); | 675 DoFinalInit(); |
| 792 } | 676 } |
| 793 | 677 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 819 // Even when Chromium is started in OTR mode, a normal profile is always | 703 // Even when Chromium is started in OTR mode, a normal profile is always |
| 820 // created first. | 704 // created first. |
| 821 if (!default_request_context_) | 705 if (!default_request_context_) |
| 822 default_request_context_ = request_context; | 706 default_request_context_ = request_context; |
| 823 | 707 |
| 824 return request_context; | 708 return request_context; |
| 825 } | 709 } |
| 826 | 710 |
| 827 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 711 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 828 int renderer_child_id) { | 712 int renderer_child_id) { |
| 829 if (extension_service_.get()) { | 713 ExtensionService* extension_service = |
| 830 const Extension* installed_app = extension_service_-> | 714 ExtensionSystemFactory::GetForProfile(this)->extension_service(); |
| 715 if (extension_service) { | |
| 716 const Extension* installed_app = extension_service-> | |
| 831 GetInstalledAppForRenderer(renderer_child_id); | 717 GetInstalledAppForRenderer(renderer_child_id); |
| 832 if (installed_app != NULL && installed_app->is_storage_isolated() && | 718 if (installed_app != NULL && installed_app->is_storage_isolated() && |
| 833 installed_app->HasAPIPermission( | 719 installed_app->HasAPIPermission( |
| 834 ExtensionAPIPermission::kExperimental)) { | 720 ExtensionAPIPermission::kExperimental)) { |
| 835 return GetRequestContextForIsolatedApp(installed_app->id()); | 721 return GetRequestContextForIsolatedApp(installed_app->id()); |
| 836 } | 722 } |
| 837 } | 723 } |
| 838 return GetRequestContext(); | 724 return GetRequestContext(); |
| 839 } | 725 } |
| 840 | 726 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 856 | 742 |
| 857 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 743 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| 858 return io_data_.GetExtensionsRequestContextGetter(); | 744 return io_data_.GetExtensionsRequestContextGetter(); |
| 859 } | 745 } |
| 860 | 746 |
| 861 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( | 747 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( |
| 862 const std::string& app_id) { | 748 const std::string& app_id) { |
| 863 return io_data_.GetIsolatedAppRequestContextGetter(app_id); | 749 return io_data_.GetIsolatedAppRequestContextGetter(app_id); |
| 864 } | 750 } |
| 865 | 751 |
| 866 void ProfileImpl::RegisterExtensionWithRequestContexts( | |
| 867 const Extension* extension) { | |
| 868 base::Time install_time; | |
| 869 if (extension->location() != Extension::COMPONENT) { | |
| 870 install_time = GetExtensionService()->extension_prefs()-> | |
| 871 GetInstallTime(extension->id()); | |
| 872 } | |
| 873 bool incognito_enabled = | |
| 874 GetExtensionService()->IsIncognitoEnabled(extension->id()); | |
| 875 BrowserThread::PostTask( | |
| 876 BrowserThread::IO, FROM_HERE, | |
| 877 base::Bind(&ExtensionInfoMap::AddExtension, extension_info_map_.get(), | |
| 878 make_scoped_refptr(extension), install_time, | |
| 879 incognito_enabled)); | |
| 880 } | |
| 881 | |
| 882 void ProfileImpl::UnregisterExtensionWithRequestContexts( | |
| 883 const std::string& extension_id, | |
| 884 const extension_misc::UnloadedExtensionReason reason) { | |
| 885 BrowserThread::PostTask( | |
| 886 BrowserThread::IO, FROM_HERE, | |
| 887 base::Bind(&ExtensionInfoMap::RemoveExtension, extension_info_map_.get(), | |
| 888 extension_id, reason)); | |
| 889 } | |
| 890 | |
| 891 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 752 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
| 892 return ssl_config_service_manager_->Get(); | 753 return ssl_config_service_manager_->Get(); |
| 893 } | 754 } |
| 894 | 755 |
| 895 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 756 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
| 896 if (!host_content_settings_map_.get()) { | 757 if (!host_content_settings_map_.get()) { |
| 897 host_content_settings_map_ = new HostContentSettingsMap( | 758 host_content_settings_map_ = new HostContentSettingsMap( |
| 898 GetPrefs(), GetExtensionService(), false); | 759 GetPrefs(), GetExtensionService(), false); |
| 899 } | 760 } |
| 900 return host_content_settings_map_.get(); | 761 return host_content_settings_map_.get(); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1355 if (!blob_storage_context_) { | 1216 if (!blob_storage_context_) { |
| 1356 blob_storage_context_ = new ChromeBlobStorageContext(); | 1217 blob_storage_context_ = new ChromeBlobStorageContext(); |
| 1357 BrowserThread::PostTask( | 1218 BrowserThread::PostTask( |
| 1358 BrowserThread::IO, FROM_HERE, | 1219 BrowserThread::IO, FROM_HERE, |
| 1359 base::Bind(&ChromeBlobStorageContext::InitializeOnIOThread, | 1220 base::Bind(&ChromeBlobStorageContext::InitializeOnIOThread, |
| 1360 blob_storage_context_.get())); | 1221 blob_storage_context_.get())); |
| 1361 } | 1222 } |
| 1362 return blob_storage_context_; | 1223 return blob_storage_context_; |
| 1363 } | 1224 } |
| 1364 | 1225 |
| 1365 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { | |
| 1366 return extension_info_map_.get(); | |
| 1367 } | |
| 1368 | |
| 1369 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { | 1226 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { |
| 1370 if (!chrome_url_data_manager_.get()) | 1227 if (!chrome_url_data_manager_.get()) |
| 1371 chrome_url_data_manager_.reset(new ChromeURLDataManager( | 1228 chrome_url_data_manager_.reset(new ChromeURLDataManager( |
| 1372 io_data_.GetChromeURLDataManagerBackendGetter())); | 1229 io_data_.GetChromeURLDataManagerBackendGetter())); |
| 1373 return chrome_url_data_manager_.get(); | 1230 return chrome_url_data_manager_.get(); |
| 1374 } | 1231 } |
| 1375 | 1232 |
| 1376 PromoCounter* ProfileImpl::GetInstantPromoCounter() { | 1233 PromoCounter* ProfileImpl::GetInstantPromoCounter() { |
| 1377 #if defined(OS_WIN) | 1234 #if defined(OS_WIN) |
| 1378 // TODO: enable this when we're ready to turn on the promo. | 1235 // TODO: enable this when we're ready to turn on the promo. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1589 FilePath* cache_path, | 1446 FilePath* cache_path, |
| 1590 int* max_size) { | 1447 int* max_size) { |
| 1591 DCHECK(cache_path); | 1448 DCHECK(cache_path); |
| 1592 DCHECK(max_size); | 1449 DCHECK(max_size); |
| 1593 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1450 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1594 if (!path.empty()) | 1451 if (!path.empty()) |
| 1595 *cache_path = path; | 1452 *cache_path = path; |
| 1596 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1453 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1597 prefs_->GetInteger(prefs::kDiskCacheSize); | 1454 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1598 } | 1455 } |
| OLD | NEW |