| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 PasswordStoreX::RegisterUserPrefs(prefs); | 233 PasswordStoreX::RegisterUserPrefs(prefs); |
| 238 #endif | 234 #endif |
| 239 } | 235 } |
| 240 | 236 |
| 241 ProfileImpl::ProfileImpl(const FilePath& path, | 237 ProfileImpl::ProfileImpl(const FilePath& path, |
| 242 Profile::Delegate* delegate) | 238 Profile::Delegate* delegate) |
| 243 : path_(path), | 239 : path_(path), |
| 244 ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( | 240 ALLOW_THIS_IN_INITIALIZER_LIST(visited_link_event_listener_( |
| 245 new VisitedLinkEventListener(this))), | 241 new VisitedLinkEventListener(this))), |
| 246 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), | 242 ALLOW_THIS_IN_INITIALIZER_LIST(io_data_(this)), |
| 247 extension_devtools_manager_(NULL), | |
| 248 host_content_settings_map_(NULL), | 243 host_content_settings_map_(NULL), |
| 249 host_zoom_map_(NULL), | 244 host_zoom_map_(NULL), |
| 250 history_service_created_(false), | 245 history_service_created_(false), |
| 251 favicon_service_created_(false), | 246 favicon_service_created_(false), |
| 252 created_web_data_service_(false), | 247 created_web_data_service_(false), |
| 253 created_password_store_(false), | 248 created_password_store_(false), |
| 254 start_time_(Time::Now()), | 249 start_time_(Time::Now()), |
| 255 #if defined(OS_WIN) | 250 #if defined(OS_WIN) |
| 256 checked_instant_promo_(false), | 251 checked_instant_promo_(false), |
| 257 #endif | 252 #endif |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // Creation has been finished. | 404 // Creation has been finished. |
| 410 if (delegate_) | 405 if (delegate_) |
| 411 delegate_->OnProfileCreated(this, true); | 406 delegate_->OnProfileCreated(this, true); |
| 412 | 407 |
| 413 content::NotificationService::current()->Notify( | 408 content::NotificationService::current()->Notify( |
| 414 chrome::NOTIFICATION_PROFILE_CREATED, | 409 chrome::NOTIFICATION_PROFILE_CREATED, |
| 415 content::Source<Profile>(this), | 410 content::Source<Profile>(this), |
| 416 content::NotificationService::NoDetails()); | 411 content::NotificationService::NoDetails()); |
| 417 } | 412 } |
| 418 | 413 |
| 419 void ProfileImpl::InitExtensions(bool extensions_enabled) { | |
| 420 if (user_script_master_ || extension_service_.get()) | |
| 421 return; // Already initialized. | |
| 422 | |
| 423 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 424 if (command_line->HasSwitch( | |
| 425 switches::kEnableExtensionTimelineApi)) { | |
| 426 extension_devtools_manager_ = new ExtensionDevToolsManager(this); | |
| 427 } | |
| 428 | |
| 429 // The ExtensionInfoMap needs to be created before the | |
| 430 // ExtensionProcessManager. | |
| 431 extension_info_map_ = new ExtensionInfoMap(); | |
| 432 extension_process_manager_.reset(ExtensionProcessManager::Create(this)); | |
| 433 extension_event_router_.reset(new ExtensionEventRouter(this)); | |
| 434 extension_message_service_ = new ExtensionMessageService(this); | |
| 435 extension_navigation_observer_.reset(new ExtensionNavigationObserver(this)); | |
| 436 | |
| 437 ExtensionErrorReporter::Init(true); // allow noisy errors. | |
| 438 | |
| 439 user_script_master_ = new UserScriptMaster(this); | |
| 440 | |
| 441 bool autoupdate_enabled = true; | |
| 442 #if defined(OS_CHROMEOS) | |
| 443 if (!extensions_enabled) | |
| 444 autoupdate_enabled = false; | |
| 445 else | |
| 446 autoupdate_enabled = !command_line->HasSwitch(switches::kGuestSession); | |
| 447 #endif | |
| 448 extension_service_.reset(new ExtensionService( | |
| 449 this, | |
| 450 CommandLine::ForCurrentProcess(), | |
| 451 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | |
| 452 extension_prefs_.get(), | |
| 453 autoupdate_enabled, | |
| 454 extensions_enabled)); | |
| 455 | |
| 456 extension_service_->component_loader()->AddDefaultComponentExtensions(); | |
| 457 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { | |
| 458 CommandLine::StringType path_list = command_line->GetSwitchValueNative( | |
| 459 switches::kLoadComponentExtension); | |
| 460 StringTokenizerT<CommandLine::StringType, | |
| 461 CommandLine::StringType::const_iterator> t(path_list, | |
| 462 FILE_PATH_LITERAL(",")); | |
| 463 while (t.GetNext()) { | |
| 464 // Load the component extension manifest synchronously. | |
| 465 // Blocking the UI thread is acceptable here since | |
| 466 // this flag designated for developers. | |
| 467 base::ThreadRestrictions::ScopedAllowIO allow_io; | |
| 468 extension_service_->component_loader()->AddOrReplace( | |
| 469 FilePath(t.token())); | |
| 470 } | |
| 471 } | |
| 472 extension_service_->Init(); | |
| 473 | |
| 474 if (extensions_enabled) { | |
| 475 // Load any extensions specified with --load-extension. | |
| 476 // TODO(yoz): Seems like this should move into ExtensionService::Init. | |
| 477 if (command_line->HasSwitch(switches::kLoadExtension)) { | |
| 478 CommandLine::StringType path_list = command_line->GetSwitchValueNative( | |
| 479 switches::kLoadExtension); | |
| 480 StringTokenizerT<CommandLine::StringType, | |
| 481 CommandLine::StringType::const_iterator> t(path_list, | |
| 482 FILE_PATH_LITERAL(",")); | |
| 483 scoped_refptr<extensions::UnpackedInstaller> installer = | |
| 484 extensions::UnpackedInstaller::Create(extension_service_.get()); | |
| 485 while (t.GetNext()) { | |
| 486 installer->LoadFromCommandLine(FilePath(t.token())); | |
| 487 } | |
| 488 } | |
| 489 } | |
| 490 | |
| 491 // Make the chrome://extension-icon/ resource available. | |
| 492 GetChromeURLDataManager()->AddDataSource(new ExtensionIconSource(this)); | |
| 493 | |
| 494 // Initialize extension event routers. Note that on Chrome OS, this will | |
| 495 // not succeed if the user has not logged in yet, in which case the | |
| 496 // event routers are initialized in LoginUtilsImpl::CompleteLogin instead. | |
| 497 // The InitEventRouters call used to be in BrowserMain, because when bookmark | |
| 498 // import happened on first run, the bookmark bar was not being correctly | |
| 499 // initialized (see issue 40144). Now that bookmarks aren't imported and | |
| 500 // the event routers need to be initialized for every profile individually, | |
| 501 // initialize them with the extension service. | |
| 502 // If this profile is being created as part of the import process, never | |
| 503 // initialize the event routers. If import is going to run in a separate | |
| 504 // process (the profile itself is on the main process), wait for import to | |
| 505 // finish before initializing the routers. | |
| 506 if (!command_line->HasSwitch(switches::kImport) && | |
| 507 !command_line->HasSwitch(switches::kImportFromFile)) { | |
| 508 if (g_browser_process->profile_manager()->will_import()) { | |
| 509 extension_service_->InitEventRoutersAfterImport(); | |
| 510 } else { | |
| 511 extension_service_->InitEventRouters(); | |
| 512 } | |
| 513 } | |
| 514 } | |
| 515 | |
| 516 void ProfileImpl::InitPromoResources() { | 414 void ProfileImpl::InitPromoResources() { |
| 517 if (promo_resource_service_) | 415 if (promo_resource_service_) |
| 518 return; | 416 return; |
| 519 | 417 |
| 520 promo_resource_service_ = new PromoResourceService(this); | 418 promo_resource_service_ = new PromoResourceService(this); |
| 521 promo_resource_service_->StartAfterDelay(); | 419 promo_resource_service_->StartAfterDelay(); |
| 522 } | 420 } |
| 523 | 421 |
| 524 void ProfileImpl::InitRegisteredProtocolHandlers() { | 422 void ProfileImpl::InitRegisteredProtocolHandlers() { |
| 525 if (protocol_handler_registry_) | 423 if (protocol_handler_registry_) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 // HistoryService will join with HistoryService's backend thread so that | 508 // HistoryService will join with HistoryService's backend thread so that |
| 611 // by the time the destructor has finished we're sure it will no longer call | 509 // by the time the destructor has finished we're sure it will no longer call |
| 612 // into the BookmarkModel. | 510 // into the BookmarkModel. |
| 613 history_service_ = NULL; | 511 history_service_ = NULL; |
| 614 bookmark_bar_model_.reset(); | 512 bookmark_bar_model_.reset(); |
| 615 | 513 |
| 616 // FaviconService depends on HistoryServce so make sure we delete | 514 // FaviconService depends on HistoryServce so make sure we delete |
| 617 // HistoryService first. | 515 // HistoryService first. |
| 618 favicon_service_.reset(); | 516 favicon_service_.reset(); |
| 619 | 517 |
| 620 if (extension_message_service_) | |
| 621 extension_message_service_->DestroyingProfile(); | |
| 622 | |
| 623 if (pref_proxy_config_tracker_.get()) | 518 if (pref_proxy_config_tracker_.get()) |
| 624 pref_proxy_config_tracker_->DetachFromPrefService(); | 519 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 625 | 520 |
| 626 if (protocol_handler_registry_) | 521 if (protocol_handler_registry_) |
| 627 protocol_handler_registry_->Finalize(); | 522 protocol_handler_registry_->Finalize(); |
| 628 | 523 |
| 629 if (host_content_settings_map_) | 524 if (host_content_settings_map_) |
| 630 host_content_settings_map_->ShutdownOnUIThread(); | 525 host_content_settings_map_->ShutdownOnUIThread(); |
| 631 | 526 |
| 632 // This causes the Preferences file to be written to disk. | 527 // This causes the Preferences file to be written to disk. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 new VisitedLinkMaster(visited_link_event_listener_.get(), this)); | 572 new VisitedLinkMaster(visited_link_event_listener_.get(), this)); |
| 678 if (!visited_links->Init()) | 573 if (!visited_links->Init()) |
| 679 return NULL; | 574 return NULL; |
| 680 visited_link_master_.swap(visited_links); | 575 visited_link_master_.swap(visited_links); |
| 681 } | 576 } |
| 682 | 577 |
| 683 return visited_link_master_.get(); | 578 return visited_link_master_.get(); |
| 684 } | 579 } |
| 685 | 580 |
| 686 ExtensionService* ProfileImpl::GetExtensionService() { | 581 ExtensionService* ProfileImpl::GetExtensionService() { |
| 687 return extension_service_.get(); | 582 return ExtensionSystemFactory::GetForProfile(this)->extension_service(); |
| 688 } | 583 } |
| 689 | 584 |
| 690 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { | 585 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { |
| 691 return user_script_master_.get(); | 586 return ExtensionSystemFactory::GetForProfile(this)->user_script_master(); |
| 692 } | |
| 693 | |
| 694 ExtensionDevToolsManager* ProfileImpl::GetExtensionDevToolsManager() { | |
| 695 return extension_devtools_manager_.get(); | |
| 696 } | 587 } |
| 697 | 588 |
| 698 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { | 589 ExtensionProcessManager* ProfileImpl::GetExtensionProcessManager() { |
| 699 return extension_process_manager_.get(); | 590 return ExtensionSystemFactory::GetForProfile(this)->process_manager(); |
| 700 } | |
| 701 | |
| 702 ExtensionMessageService* ProfileImpl::GetExtensionMessageService() { | |
| 703 return extension_message_service_.get(); | |
| 704 } | 591 } |
| 705 | 592 |
| 706 ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { | 593 ExtensionEventRouter* ProfileImpl::GetExtensionEventRouter() { |
| 707 return extension_event_router_.get(); | 594 return ExtensionSystemFactory::GetForProfile(this)->event_router(); |
| 708 } | 595 } |
| 709 | 596 |
| 710 ExtensionSpecialStoragePolicy* | 597 ExtensionSpecialStoragePolicy* |
| 711 ProfileImpl::GetExtensionSpecialStoragePolicy() { | 598 ProfileImpl::GetExtensionSpecialStoragePolicy() { |
| 712 if (!extension_special_storage_policy_.get()) { | 599 if (!extension_special_storage_policy_.get()) { |
| 713 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( | 600 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( |
| 714 CookieSettings::Factory::GetForProfile(this)); | 601 CookieSettings::Factory::GetForProfile(this)); |
| 715 } | 602 } |
| 716 return extension_special_storage_policy_.get(); | 603 return extension_special_storage_policy_.get(); |
| 717 } | 604 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 733 g_browser_process->local_state()); | 620 g_browser_process->local_state()); |
| 734 } | 621 } |
| 735 | 622 |
| 736 // The last session exited cleanly if there is no pref for | 623 // The last session exited cleanly if there is no pref for |
| 737 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. | 624 // kSessionExitedCleanly or the value for kSessionExitedCleanly is true. |
| 738 last_session_exited_cleanly_ = | 625 last_session_exited_cleanly_ = |
| 739 prefs_->GetBoolean(prefs::kSessionExitedCleanly); | 626 prefs_->GetBoolean(prefs::kSessionExitedCleanly); |
| 740 // Mark the session as open. | 627 // Mark the session as open. |
| 741 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); | 628 prefs_->SetBoolean(prefs::kSessionExitedCleanly, false); |
| 742 | 629 |
| 743 bool extensions_disabled = | |
| 744 prefs_->GetBoolean(prefs::kDisableExtensions) || | |
| 745 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableExtensions); | |
| 746 | |
| 747 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); | 630 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); |
| 748 | 631 |
| 749 // Ensure that preferences set by extensions are restored in the profile | |
| 750 // as early as possible. The constructor takes care of that. | |
| 751 extension_prefs_.reset(new ExtensionPrefs( | |
| 752 prefs_.get(), | |
| 753 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | |
| 754 GetExtensionPrefValueMap())); | |
| 755 extension_prefs_->Init(extensions_disabled); | |
| 756 | |
| 757 DCHECK(!net_pref_observer_.get()); | 632 DCHECK(!net_pref_observer_.get()); |
| 758 net_pref_observer_.reset(new NetPrefObserver( | 633 net_pref_observer_.reset(new NetPrefObserver( |
| 759 prefs_.get(), | 634 prefs_.get(), |
| 760 prerender::PrerenderManagerFactory::GetForProfile(this), | 635 prerender::PrerenderManagerFactory::GetForProfile(this), |
| 761 predictor_)); | 636 predictor_)); |
| 762 | 637 |
| 763 DoFinalInit(); | 638 DoFinalInit(); |
| 764 } | 639 } |
| 765 | 640 |
| 766 PrefService* ProfileImpl::GetPrefs() { | 641 PrefService* ProfileImpl::GetPrefs() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 791 // Even when Chromium is started in OTR mode, a normal profile is always | 666 // Even when Chromium is started in OTR mode, a normal profile is always |
| 792 // created first. | 667 // created first. |
| 793 if (!default_request_context_) | 668 if (!default_request_context_) |
| 794 default_request_context_ = request_context; | 669 default_request_context_ = request_context; |
| 795 | 670 |
| 796 return request_context; | 671 return request_context; |
| 797 } | 672 } |
| 798 | 673 |
| 799 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 674 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 800 int renderer_child_id) { | 675 int renderer_child_id) { |
| 801 if (extension_service_.get()) { | 676 ExtensionService* extension_service = |
| 802 const Extension* installed_app = extension_service_-> | 677 ExtensionSystemFactory::GetForProfile(this)->extension_service(); |
| 678 if (extension_service) { |
| 679 const Extension* installed_app = extension_service-> |
| 803 GetInstalledAppForRenderer(renderer_child_id); | 680 GetInstalledAppForRenderer(renderer_child_id); |
| 804 if (installed_app != NULL && installed_app->is_storage_isolated() && | 681 if (installed_app != NULL && installed_app->is_storage_isolated() && |
| 805 installed_app->HasAPIPermission( | 682 installed_app->HasAPIPermission( |
| 806 ExtensionAPIPermission::kExperimental)) { | 683 ExtensionAPIPermission::kExperimental)) { |
| 807 return GetRequestContextForIsolatedApp(installed_app->id()); | 684 return GetRequestContextForIsolatedApp(installed_app->id()); |
| 808 } | 685 } |
| 809 } | 686 } |
| 810 return GetRequestContext(); | 687 return GetRequestContext(); |
| 811 } | 688 } |
| 812 | 689 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 828 | 705 |
| 829 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 706 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| 830 return io_data_.GetExtensionsRequestContextGetter(); | 707 return io_data_.GetExtensionsRequestContextGetter(); |
| 831 } | 708 } |
| 832 | 709 |
| 833 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( | 710 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( |
| 834 const std::string& app_id) { | 711 const std::string& app_id) { |
| 835 return io_data_.GetIsolatedAppRequestContextGetter(app_id); | 712 return io_data_.GetIsolatedAppRequestContextGetter(app_id); |
| 836 } | 713 } |
| 837 | 714 |
| 838 void ProfileImpl::RegisterExtensionWithRequestContexts( | |
| 839 const Extension* extension) { | |
| 840 base::Time install_time; | |
| 841 if (extension->location() != Extension::COMPONENT) { | |
| 842 install_time = GetExtensionService()->extension_prefs()-> | |
| 843 GetInstallTime(extension->id()); | |
| 844 } | |
| 845 bool incognito_enabled = | |
| 846 GetExtensionService()->IsIncognitoEnabled(extension->id()); | |
| 847 BrowserThread::PostTask( | |
| 848 BrowserThread::IO, FROM_HERE, | |
| 849 base::Bind(&ExtensionInfoMap::AddExtension, extension_info_map_.get(), | |
| 850 make_scoped_refptr(extension), install_time, | |
| 851 incognito_enabled)); | |
| 852 } | |
| 853 | |
| 854 void ProfileImpl::UnregisterExtensionWithRequestContexts( | |
| 855 const std::string& extension_id, | |
| 856 const extension_misc::UnloadedExtensionReason reason) { | |
| 857 BrowserThread::PostTask( | |
| 858 BrowserThread::IO, FROM_HERE, | |
| 859 base::Bind(&ExtensionInfoMap::RemoveExtension, extension_info_map_.get(), | |
| 860 extension_id, reason)); | |
| 861 } | |
| 862 | |
| 863 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 715 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
| 864 return ssl_config_service_manager_->Get(); | 716 return ssl_config_service_manager_->Get(); |
| 865 } | 717 } |
| 866 | 718 |
| 867 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 719 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
| 868 if (!host_content_settings_map_.get()) { | 720 if (!host_content_settings_map_.get()) { |
| 869 host_content_settings_map_ = new HostContentSettingsMap( | 721 host_content_settings_map_ = new HostContentSettingsMap( |
| 870 GetPrefs(), GetExtensionService(), false); | 722 GetPrefs(), GetExtensionService(), false); |
| 871 } | 723 } |
| 872 return host_content_settings_map_.get(); | 724 return host_content_settings_map_.get(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 SessionServiceFactory::GetForProfile(this); | 1111 SessionServiceFactory::GetForProfile(this); |
| 1260 } | 1112 } |
| 1261 | 1113 |
| 1262 TokenService* ProfileImpl::GetTokenService() { | 1114 TokenService* ProfileImpl::GetTokenService() { |
| 1263 if (!token_service_.get()) { | 1115 if (!token_service_.get()) { |
| 1264 token_service_.reset(new TokenService()); | 1116 token_service_.reset(new TokenService()); |
| 1265 } | 1117 } |
| 1266 return token_service_.get(); | 1118 return token_service_.get(); |
| 1267 } | 1119 } |
| 1268 | 1120 |
| 1269 ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { | |
| 1270 return extension_info_map_.get(); | |
| 1271 } | |
| 1272 | |
| 1273 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { | 1121 ChromeURLDataManager* ProfileImpl::GetChromeURLDataManager() { |
| 1274 if (!chrome_url_data_manager_.get()) | 1122 if (!chrome_url_data_manager_.get()) |
| 1275 chrome_url_data_manager_.reset(new ChromeURLDataManager( | 1123 chrome_url_data_manager_.reset(new ChromeURLDataManager( |
| 1276 io_data_.GetChromeURLDataManagerBackendGetter())); | 1124 io_data_.GetChromeURLDataManagerBackendGetter())); |
| 1277 return chrome_url_data_manager_.get(); | 1125 return chrome_url_data_manager_.get(); |
| 1278 } | 1126 } |
| 1279 | 1127 |
| 1280 PromoCounter* ProfileImpl::GetInstantPromoCounter() { | 1128 PromoCounter* ProfileImpl::GetInstantPromoCounter() { |
| 1281 #if defined(OS_WIN) | 1129 #if defined(OS_WIN) |
| 1282 // TODO: enable this when we're ready to turn on the promo. | 1130 // TODO: enable this when we're ready to turn on the promo. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 FilePath* cache_path, | 1339 FilePath* cache_path, |
| 1492 int* max_size) { | 1340 int* max_size) { |
| 1493 DCHECK(cache_path); | 1341 DCHECK(cache_path); |
| 1494 DCHECK(max_size); | 1342 DCHECK(max_size); |
| 1495 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1343 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1496 if (!path.empty()) | 1344 if (!path.empty()) |
| 1497 *cache_path = path; | 1345 *cache_path = path; |
| 1498 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1346 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1499 prefs_->GetInteger(prefs::kDiskCacheSize); | 1347 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1500 } | 1348 } |
| OLD | NEW |