diff options
Diffstat (limited to 'chrome')
57 files changed, 113 insertions, 234 deletions
diff --git a/chrome/browser/apps/ephemeral_app_browsertest.cc b/chrome/browser/apps/ephemeral_app_browsertest.cc index e21b2b8..90755a3 100644 --- a/chrome/browser/apps/ephemeral_app_browsertest.cc +++ b/chrome/browser/apps/ephemeral_app_browsertest.cc @@ -371,8 +371,8 @@ class EphemeralAppBrowserTest : public EphemeralAppTestBase { // Verify that the event page of the app has not been loaded. void VerifyAppNotLoaded(const std::string& app_id) { - EXPECT_FALSE(ExtensionSystem::Get(profile())-> - process_manager()->GetBackgroundHostForExtension(app_id)); + EXPECT_FALSE(extensions::ProcessManager::Get(profile()) + ->GetBackgroundHostForExtension(app_id)); } // Verify properties of ephemeral apps. diff --git a/chrome/browser/apps/window_controls_browsertest.cc b/chrome/browser/apps/window_controls_browsertest.cc index 4397754..75feeab 100644 --- a/chrome/browser/apps/window_controls_browsertest.cc +++ b/chrome/browser/apps/window_controls_browsertest.cc @@ -22,7 +22,7 @@ class WindowControlsTest : public extensions::PlatformAppBrowserTest { content::WebContents* WindowControlsTest::GetWebContentsForExtensionWindow( const extensions::Extension* extension) { extensions::ProcessManager* process_manager = - extensions::ExtensionSystem::Get(profile())->process_manager(); + extensions::ProcessManager::Get(profile()); // Lookup render view host for background page. const extensions::ExtensionHost* extension_host = diff --git a/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc b/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc index b807b55..1e4695f 100644 --- a/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc +++ b/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc @@ -76,7 +76,6 @@ class KeywordExtensionsDelegateImplTest : public ExtensionServiceTestBase { void KeywordExtensionsDelegateImplTest::SetUp() { ExtensionServiceTestBase::SetUp(); InitializeExtensionService(CreateDefaultInitParams()); - InitializeProcessManager(); } void KeywordExtensionsDelegateImplTest::RunTest(bool incognito) { diff --git a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc index ef85a8d..7dc34ef 100644 --- a/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc +++ b/chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc @@ -83,9 +83,9 @@ class LoggedInSpokenFeedbackTest : public InProcessBrowserTest { void RunJavaScriptInChromeVoxBackgroundPage(const std::string& script) { extensions::ExtensionHost* host = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager()->GetBackgroundHostForExtension( - extension_misc::kChromeVoxExtensionId); + extensions::ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension( + extension_misc::kChromeVoxExtensionId); CHECK(content::ExecuteScript(host->host_contents(), script)); } diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc index 9e0604c..3076761 100644 --- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc +++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc @@ -44,7 +44,6 @@ #include "extensions/browser/event_router.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_system.h" #include "storage/common/fileapi/file_system_types.h" #include "storage/common/fileapi/file_system_util.h" @@ -271,13 +270,9 @@ std::string FileErrorToErrorName(base::File::Error error_code) { void GrantAccessForAddedProfileToRunningInstance(Profile* added_profile, Profile* running_profile) { - extensions::ProcessManager* const process_manager = - extensions::ExtensionSystem::Get(running_profile)->process_manager(); - if (!process_manager) - return; - extensions::ExtensionHost* const extension_host = - process_manager->GetBackgroundHostForExtension(kFileManagerAppId); + extensions::ProcessManager::Get(running_profile) + ->GetBackgroundHostForExtension(kFileManagerAppId); if (!extension_host || !extension_host->render_process_host()) return; diff --git a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc index 0b40283..e326fb0 100644 --- a/chrome/browser/chromeos/file_manager/file_browser_handlers.cc +++ b/chrome/browser/chromeos/file_manager/file_browser_handlers.cc @@ -61,7 +61,7 @@ int ExtractProcessFromExtensionId(Profile* profile, GURL extension_url = Extension::GetBaseURLFromExtensionId(extension_id); extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(profile)->process_manager(); + extensions::ProcessManager::Get(profile); SiteInstance* site_instance = manager->GetSiteInstanceForURL(extension_url); if (!site_instance || !site_instance->HasProcess()) diff --git a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc index efdebc5..1e8d23c 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine_browsertests.cc @@ -247,8 +247,7 @@ IN_PROC_BROWSER_TEST_P(InputMethodEngineBrowserTest, ASSERT_TRUE(engine_handler); extensions::ExtensionHost* host = - extensions::ExtensionSystem::Get(profile()) - ->process_manager() + extensions::ProcessManager::Get(profile()) ->GetBackgroundHostForExtension(extension_->id()); ASSERT_TRUE(host); diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc index 5523b00..ca33dd9 100644 --- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc +++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc @@ -660,7 +660,7 @@ class MergeSessionTest : public OAuth2Test { const GURL& GetBackGroundPageUrl(const std::string& extension_id) { extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(profile())->process_manager(); + extensions::ProcessManager::Get(profile()); extensions::ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); return host->host_contents()->GetURL(); @@ -669,7 +669,7 @@ class MergeSessionTest : public OAuth2Test { void JsExpectOnBackgroundPage(const std::string& extension_id, const std::string& expression) { extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(profile())->process_manager(); + extensions::ProcessManager::Get(profile()); extensions::ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); if (host == NULL) { diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 79f2ffc..b380ea5 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc @@ -351,8 +351,7 @@ class DevToolsExtensionTest : public DevToolsSanityTest, FROM_HERE, timeout.callback(), TestTimeouts::action_timeout()); extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ProcessManager::ViewSet all_views = manager->GetAllViews(); for (extensions::ProcessManager::ViewSet::const_iterator iter = all_views.begin(); diff --git a/chrome/browser/devtools/devtools_target_impl.cc b/chrome/browser/devtools/devtools_target_impl.cc index 6ccc73d..23c9411 100644 --- a/chrome/browser/devtools/devtools_target_impl.cc +++ b/chrome/browser/devtools/devtools_target_impl.cc @@ -20,7 +20,6 @@ #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/browser/process_manager.h" #include "extensions/common/constants.h" @@ -107,12 +106,10 @@ WebContentsTarget::WebContentsTarget(WebContents* web_contents, bool is_tab) Profile::FromBrowserContext(web_contents->GetBrowserContext()); if (!profile) return; - extensions::ExtensionSystem* extension_system = - extensions::ExtensionSystem::Get(profile); set_title(extension->name()); extensions::ExtensionHost* extension_host = - extension_system->process_manager()->GetBackgroundHostForExtension( - extension->id()); + extensions::ProcessManager::Get(profile) + ->GetBackgroundHostForExtension(extension->id()); if (extension_host && extension_host->host_contents() == web_contents) { set_type(kTargetTypeBackgroundPage); diff --git a/chrome/browser/extensions/alert_apitest.cc b/chrome/browser/extensions/alert_apitest.cc index dbd7c55..2b57874 100644 --- a/chrome/browser/extensions/alert_apitest.cc +++ b/chrome/browser/extensions/alert_apitest.cc @@ -10,7 +10,6 @@ #include "components/app_modal_dialogs/app_modal_dialog.h" #include "content/public/browser/render_frame_host.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" @@ -19,8 +18,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, AlertBasic) { const extensions::Extension* extension = GetSingleLoadedExtension(); extensions::ExtensionHost* host = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager()->GetBackgroundHostForExtension(extension->id()); + extensions::ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(extension->id()); ASSERT_TRUE(host); host->host_contents()->GetMainFrame()->ExecuteJavaScript( base::ASCIIToUTF16("alert('This should not crash.');")); diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc index 4745a24..dfd2ff8 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.cc +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc @@ -45,7 +45,6 @@ #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry_observer.h" -#include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" #include "extensions/common/error_utils.h" #include "extensions/common/extension.h" @@ -516,8 +515,7 @@ bool DebuggerFunction::InitAgentHost() { } } else if (debuggee_.extension_id) { ExtensionHost* extension_host = - ExtensionSystem::Get(GetProfile()) - ->process_manager() + ProcessManager::Get(GetProfile()) ->GetBackgroundHostForExtension(*debuggee_.extension_id); if (extension_host) { if (PermissionsData::IsRestrictedUrl(extension_host->GetURL(), diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index de6e61b..1f95298 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -563,8 +563,7 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction:: bool extension_is_enabled) { ItemInspectViewList result; // Get the extension process's active views. - ProcessManager* process_manager = - ExtensionSystem::Get(GetProfile())->process_manager(); + ProcessManager* process_manager = ProcessManager::Get(GetProfile()); GetInspectablePagesForExtensionProcess( extension, process_manager->GetRenderViewHostsForExtension(extension->id()), @@ -590,8 +589,8 @@ ItemInspectViewList DeveloperPrivateGetItemsInfoFunction:: // app windows for incognito process. if (service->profile()->HasOffTheRecordProfile() && IncognitoInfo::IsSplitMode(extension)) { - process_manager = ExtensionSystem::Get( - service->profile()->GetOffTheRecordProfile())->process_manager(); + process_manager = + ProcessManager::Get(service->profile()->GetOffTheRecordProfile()); GetInspectablePagesForExtensionProcess( extension, process_manager->GetRenderViewHostsForExtension(extension->id()), diff --git a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc index ed52900..3b034cc 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc @@ -9,7 +9,6 @@ #include "chrome/browser/extensions/extension_action_icon_factory.h" #include "chrome/browser/extensions/extension_action_manager.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/extensions/extension_toolbar_model.h" #include "chrome/browser/extensions/extension_util.h" @@ -26,6 +25,7 @@ #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/notification_types.h" +#include "extensions/browser/process_manager.h" #include "extensions/browser/test_extension_registry_observer.h" #include "extensions/common/feature_switch.h" #include "extensions/test/result_catcher.h" @@ -542,7 +542,7 @@ IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, DISABLED_CloseBackgroundPage) { // There is a background page and a browser action with no badge text. extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); ASSERT_TRUE(manager->GetBackgroundHostForExtension(extension->id())); ExtensionAction* action = GetBrowserAction(*extension); ASSERT_EQ("", action->GetBadgeText(ExtensionAction::kDefaultTabId)); diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index 98fe3aa..ebf9895 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc @@ -33,8 +33,8 @@ class ExtensionManagementApiBrowserTest : public ExtensionBrowserTest { protected: bool CrashEnabledExtension(const std::string& extension_id) { ExtensionHost* background_host = - ExtensionSystem::Get(browser()->profile())-> - process_manager()->GetBackgroundHostForExtension(extension_id); + ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(extension_id); if (!background_host) return false; content::CrashTab(background_host->host_contents()); diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc index 228c98d..9140b0c 100644 --- a/chrome/browser/extensions/api/management/management_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_browsertest.cc @@ -82,8 +82,7 @@ class ExtensionManagementTest : public ExtensionBrowserTest { // background page is correct. This is to ensure that the processes are in // sync with the Extension. extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ExtensionHost* ext_host = manager->GetBackgroundHostForExtension(extension->id()); EXPECT_TRUE(ext_host); @@ -177,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_InstallRequiresConfirm) { // Tests that disabling and re-enabling an extension works. IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, DisableEnable) { extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); const size_t size_before = registry->enabled_extensions().size(); diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc index 89be45e..1d947fe 100644 --- a/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries/media_galleries_watch_apitest.cc @@ -13,14 +13,13 @@ #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/media_galleries/media_file_system_registry.h" #include "chrome/browser/media_galleries/media_galleries_preferences.h" #include "chrome/browser/media_galleries/media_galleries_test_util.h" #include "chrome/common/chrome_paths.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" #include "extensions/common/switches.h" #include "extensions/test/extension_test_message_listener.h" @@ -138,9 +137,7 @@ class MediaGalleriesGalleryWatchApiTest : public ExtensionApiTest { private: void GetBackgroundHostForTestExtension() { ASSERT_TRUE(extension_); - extensions::ExtensionSystem* extension_system = - extensions::ExtensionSystem::Get(browser()->profile()); - background_host_ = extension_system->process_manager() + background_host_ = extensions::ProcessManager::Get(browser()->profile()) ->GetBackgroundHostForExtension(extension_->id()) ->render_view_host(); ASSERT_TRUE(background_host_); diff --git a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc index e5817e8..6eb2536 100644 --- a/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc +++ b/chrome/browser/extensions/api/media_galleries_private/media_galleries_watch_apitest.cc @@ -13,14 +13,13 @@ #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/media_galleries/media_file_system_registry.h" #include "chrome/browser/media_galleries/media_galleries_preferences.h" #include "chrome/browser/media_galleries/media_galleries_test_util.h" #include "chrome/common/chrome_paths.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" #include "extensions/common/switches.h" #include "extensions/test/extension_test_message_listener.h" @@ -134,11 +133,9 @@ class MediaGalleriesPrivateGalleryWatchApiTest : public ExtensionApiTest { private: void GetBackgroundHostForTestExtension() { ASSERT_TRUE(extension_); - extensions::ExtensionSystem* extension_system = - extensions::ExtensionSystem::Get(browser()->profile()); - background_host_ = - extension_system->process_manager()->GetBackgroundHostForExtension( - extension_->id())->render_view_host(); + background_host_ = extensions::ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(extension_->id()) + ->render_view_host(); ASSERT_TRUE(background_host_); } diff --git a/chrome/browser/extensions/api/messaging/extension_message_port.cc b/chrome/browser/extensions/api/messaging/extension_message_port.cc index 08ceddf..d5d0b1f 100644 --- a/chrome/browser/extensions/api/messaging/extension_message_port.cc +++ b/chrome/browser/extensions/api/messaging/extension_message_port.cc @@ -7,7 +7,6 @@ #include "chrome/browser/profiles/profile.h" #include "content/public/browser/render_process_host.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/extension_messages.h" #include "extensions/common/manifest_handlers/background_info.h" @@ -56,8 +55,7 @@ void ExtensionMessagePort::DispatchOnMessage(const Message& message, void ExtensionMessagePort::IncrementLazyKeepaliveCount() { Profile* profile = Profile::FromBrowserContext(process_->GetBrowserContext()); - extensions::ProcessManager* pm = - ExtensionSystem::Get(profile)->process_manager(); + extensions::ProcessManager* pm = ProcessManager::Get(profile); ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_); if (host && BackgroundInfo::HasLazyBackgroundPage(host->extension())) pm->IncrementLazyKeepaliveCount(host->extension()); @@ -70,8 +68,7 @@ void ExtensionMessagePort::IncrementLazyKeepaliveCount() { void ExtensionMessagePort::DecrementLazyKeepaliveCount() { Profile* profile = Profile::FromBrowserContext(process_->GetBrowserContext()); - extensions::ProcessManager* pm = - ExtensionSystem::Get(profile)->process_manager(); + extensions::ProcessManager* pm = ProcessManager::Get(profile); ExtensionHost* host = pm->GetBackgroundHostForExtension(extension_id_); if (host && host == background_host_ptr_) pm->DecrementLazyKeepaliveCount(host->extension()); diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc index fb72711..6256bce 100644 --- a/chrome/browser/extensions/api/messaging/message_service.cc +++ b/chrome/browser/extensions/api/messaging/message_service.cc @@ -163,7 +163,7 @@ static content::RenderProcessHost* GetExtensionProcess( BrowserContext* context, const std::string& extension_id) { SiteInstance* site_instance = - ExtensionSystem::Get(context)->process_manager()->GetSiteInstanceForURL( + ProcessManager::Get(context)->GetSiteInstanceForURL( Extension::GetBaseURLFromExtensionId(extension_id)); return site_instance->HasProcess() ? site_instance->GetProcess() : NULL; } diff --git a/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc b/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc index 38d7c39..ed26073 100644 --- a/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc +++ b/chrome/browser/extensions/api/system_indicator/system_indicator_apitest.cc @@ -9,7 +9,6 @@ #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/lazy_background_page_test_util.h" #include "chrome/browser/ui/browser.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" #include "extensions/test/result_catcher.h" @@ -58,8 +57,7 @@ IN_PROC_BROWSER_TEST_F(SystemIndicatorApiTest, SystemIndicator) { ASSERT_TRUE(extension) << message_; // Lazy Background Page has been shut down. - extensions::ProcessManager* pm = - extensions::ExtensionSystem::Get(profile())->process_manager(); + extensions::ProcessManager* pm = extensions::ProcessManager::Get(profile()); EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); EXPECT_TRUE(manager->SendClickEventToExtensionForTest(extension->id())); diff --git a/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc b/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc index ff051f5..2164a05 100644 --- a/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc +++ b/chrome/browser/extensions/api/system_storage/system_storage_eject_apitest.cc @@ -16,7 +16,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/test/test_utils.h" #include "extensions/browser/api/system_storage/storage_info_provider.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" #include "extensions/test/extension_test_message_listener.h" @@ -44,9 +43,9 @@ class SystemStorageEjectApiTest : public ExtensionApiTest { content::RenderViewHost* GetHost() { const extensions::Extension* extension = LoadExtension(test_data_dir_.AppendASCII("system/storage_eject")); - return extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager()->GetBackgroundHostForExtension(extension->id())-> - render_view_host(); + return extensions::ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(extension->id()) + ->render_view_host(); } void ExecuteCmdAndCheckReply(content::RenderViewHost* host, diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index 20beade..fc1ea8b 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -614,7 +614,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageNaClTest, ExtensionTestMessageListener nacl_modules_loaded("nacl_modules_loaded", true); LaunchTestingApp(); extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); ImpulseCallbackCounter active_impulse_counter(manager, extension()->id()); EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); @@ -640,7 +640,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageNaClTest, ExtensionTestMessageListener nacl_modules_loaded("nacl_modules_loaded", true); LaunchTestingApp(); extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); ImpulseCallbackCounter idle_impulse_counter(manager, extension()->id()); EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied()); diff --git a/chrome/browser/extensions/browsertest_util.cc b/chrome/browser/extensions/browsertest_util.cc index 21185f819..ceed312 100644 --- a/chrome/browser/extensions/browsertest_util.cc +++ b/chrome/browser/extensions/browsertest_util.cc @@ -7,7 +7,6 @@ #include "chrome/browser/profiles/profile.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "testing/gtest/include/gtest/gtest.h" @@ -18,7 +17,7 @@ std::string ExecuteScriptInBackgroundPage(Profile* profile, const std::string& extension_id, const std::string& script) { extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(profile)->process_manager(); + extensions::ProcessManager::Get(profile); extensions::ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); if (host == NULL) { @@ -38,7 +37,7 @@ bool ExecuteScriptInBackgroundPageNoWait(Profile* profile, const std::string& extension_id, const std::string& script) { extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(profile)->process_manager(); + extensions::ProcessManager::Get(profile); extensions::ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); if (host == NULL) { diff --git a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc index 4c5fb21..a807334 100644 --- a/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc +++ b/chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc @@ -260,7 +260,7 @@ ChromeContentBrowserClientExtensionsPart::ShouldTryToUseExistingProcessHost( std::vector<Profile*> profiles = g_browser_process->profile_manager()-> GetLoadedProfiles(); for (size_t i = 0; i < profiles.size(); ++i) { - ProcessManager* epm = ExtensionSystem::Get(profiles[i])->process_manager(); + ProcessManager* epm = ProcessManager::Get(profiles[i]); for (ProcessManager::const_iterator iter = epm->background_hosts().begin(); iter != epm->background_hosts().end(); ++iter) { const ExtensionHost* host = *iter; diff --git a/chrome/browser/extensions/chrome_process_manager_delegate.cc b/chrome/browser/extensions/chrome_process_manager_delegate.cc index 2ec9230..a155b77b 100644 --- a/chrome/browser/extensions/chrome_process_manager_delegate.cc +++ b/chrome/browser/extensions/chrome_process_manager_delegate.cc @@ -16,6 +16,7 @@ #include "content/public/browser/notification_service.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" +#include "extensions/browser/process_manager_factory.h" #include "extensions/common/one_shot_event.h" namespace extensions { @@ -102,9 +103,8 @@ void ChromeProcessManagerDelegate::OnBrowserWindowReady(Browser* browser) { // Inform the process manager for this profile that the window is ready. // We continue to observe the notification in case browser windows open for // a related incognito profile or other regular profiles. - ProcessManager* manager = system->process_manager(); - if (!manager) // Tests may not have a process manager. - return; + ProcessManager* manager = ProcessManager::Get(profile); + DCHECK(manager); DCHECK_EQ(profile, manager->GetBrowserContext()); manager->MaybeCreateStartupBackgroundHosts(); @@ -114,8 +114,7 @@ void ChromeProcessManagerDelegate::OnBrowserWindowReady(Browser* browser) { // non-incognito window opened. if (profile->IsOffTheRecord()) { Profile* original_profile = profile->GetOriginalProfile(); - ProcessManager* original_manager = - ExtensionSystem::Get(original_profile)->process_manager(); + ProcessManager* original_manager = ProcessManager::Get(original_profile); DCHECK(original_manager); DCHECK_EQ(original_profile, original_manager->GetBrowserContext()); original_manager->MaybeCreateStartupBackgroundHosts(); @@ -128,14 +127,13 @@ void ChromeProcessManagerDelegate::OnProfileCreated(Profile* profile) { return; // The profile can be created before the extension system is ready. - ProcessManager* manager = ExtensionSystem::Get(profile)->process_manager(); - if (!manager) + if (!ExtensionSystem::Get(profile)->ready().is_signaled()) return; // The profile might have been initialized asynchronously (in parallel with // extension system startup). Now that initialization is complete the // ProcessManager can load deferred background pages. - manager->MaybeCreateStartupBackgroundHosts(); + ProcessManager::Get(profile)->MaybeCreateStartupBackgroundHosts(); } void ChromeProcessManagerDelegate::OnProfileDestroyed(Profile* profile) { @@ -143,19 +141,22 @@ void ChromeProcessManagerDelegate::OnProfileDestroyed(Profile* profile) { // have time to shutdown various objects on different threads. The // ProfileManager destructor is called too late in the shutdown sequence. // http://crbug.com/15708 - ProcessManager* manager = ExtensionSystem::Get(profile)->process_manager(); - if (manager) + ProcessManager* manager = + ProcessManagerFactory::GetForBrowserContextIfExists(profile); + if (manager) { manager->CloseBackgroundHosts(); + } // If this profile owns an incognito profile, but it is destroyed before the // incognito profile is destroyed, then close the incognito background hosts // as well. This happens in a few tests. http://crbug.com/138843 if (!profile->IsOffTheRecord() && profile->HasOffTheRecordProfile()) { ProcessManager* incognito_manager = - ExtensionSystem::Get(profile->GetOffTheRecordProfile()) - ->process_manager(); - if (incognito_manager) + ProcessManagerFactory::GetForBrowserContextIfExists( + profile->GetOffTheRecordProfile()); + if (incognito_manager) { incognito_manager->CloseBackgroundHosts(); + } } } diff --git a/chrome/browser/extensions/devtools_util.cc b/chrome/browser/extensions/devtools_util.cc index 28e4790..8f75ac7 100644 --- a/chrome/browser/extensions/devtools_util.cc +++ b/chrome/browser/extensions/devtools_util.cc @@ -28,8 +28,8 @@ void InspectExtensionHost(ExtensionHost* host) { void InspectBackgroundPage(const Extension* extension, Profile* profile) { DCHECK(extension); ExtensionSystem* system = ExtensionSystem::Get(profile); - ExtensionHost* host = - system->process_manager()->GetBackgroundHostForExtension(extension->id()); + ExtensionHost* host = ProcessManager::Get(profile) + ->GetBackgroundHostForExtension(extension->id()); if (host) { InspectExtensionHost(host); } else { diff --git a/chrome/browser/extensions/extension_bindings_apitest.cc b/chrome/browser/extensions/extension_bindings_apitest.cc index 5f1bb82..b84e6b9 100644 --- a/chrome/browser/extensions/extension_bindings_apitest.cc +++ b/chrome/browser/extensions/extension_bindings_apitest.cc @@ -10,7 +10,6 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/test/extension_test_message_listener.h" #include "extensions/test/result_catcher.h" @@ -44,7 +43,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, LastError) { // Get the ExtensionHost that is hosting our background page. extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ExtensionHost* host = FindHostWithPath(manager, "/bg.html", 1); bool result = false; diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 6d790c7..072aa4d 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -53,8 +53,7 @@ class ExtensionCrashRecoveryTestBase : public ExtensionBrowserTest { } extensions::ProcessManager* GetProcessManager() { - return extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager(); + return extensions::ProcessManager::Get(browser()->profile()); } ExtensionRegistry* GetExtensionRegistry() { diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 8223ed1..7636dfe 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -598,7 +598,8 @@ void ExtensionService::ReloadExtensionImpl( // the inspector and hang onto a cookie for it, so that we can reattach // later. // TODO(yoz): this is not incognito-safe! - extensions::ProcessManager* manager = system_->process_manager(); + extensions::ProcessManager* manager = + extensions::ProcessManager::Get(profile_); extensions::ExtensionHost* host = manager->GetBackgroundHostForExtension(extension_id); if (host && DevToolsAgentHost::HasFor(host->host_contents())) { diff --git a/chrome/browser/extensions/extension_service_test_base.cc b/chrome/browser/extensions/extension_service_test_base.cc index 365e377..9cc4b6ce 100644 --- a/chrome/browser/extensions/extension_service_test_base.cc +++ b/chrome/browser/extensions/extension_service_test_base.cc @@ -170,11 +170,6 @@ void ExtensionServiceTestBase::InitializeExtensionServiceWithUpdater() { service_->updater()->Start(); } -void ExtensionServiceTestBase::InitializeProcessManager() { - static_cast<extensions::TestExtensionSystem*>( - ExtensionSystem::Get(profile_.get()))->CreateProcessManager(); -} - void ExtensionServiceTestBase::SetUp() { ExtensionErrorReporter::GetInstance()->ClearErrors(); } diff --git a/chrome/browser/extensions/extension_service_test_base.h b/chrome/browser/extensions/extension_service_test_base.h index bd24766..8e5cb7a 100644 --- a/chrome/browser/extensions/extension_service_test_base.h +++ b/chrome/browser/extensions/extension_service_test_base.h @@ -85,9 +85,6 @@ class ExtensionServiceTestBase : public testing::Test { // Initialize an ExtensionService with autoupdate enabled. void InitializeExtensionServiceWithUpdater(); - // Initialize the associated ProcessManager. - void InitializeProcessManager(); - // TODO(rdevlin.cronin): Pull out more methods from ExtensionServiceTest that // are commonly used and/or reimplemented. For instance, methods to install // extensions from various locations, etc. diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 3e8614e..ebf0296 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -2819,7 +2819,6 @@ TEST_F(ExtensionServiceTest, LoadExtensionsWithPlugins) { InitPluginService(); InitializeEmptyExtensionService(); - InitializeProcessManager(); service()->set_show_extensions_prompts(true); // Start by canceling any install prompts. @@ -4070,7 +4069,6 @@ TEST_F(ExtensionServiceTest, ReloadExtensions) { // Tests reloading an extension. TEST_F(ExtensionServiceTest, ReloadExtension) { InitializeEmptyExtensionService(); - InitializeProcessManager(); // Simple extension that should install without error. const char* extension_id = "behllobkkfkfnphdnhnkndlbkcpglgmj"; @@ -5558,7 +5556,6 @@ TEST_F(ExtensionServiceTest, GetSyncDataFilter) { TEST_F(ExtensionServiceTest, GetSyncExtensionDataUserSettings) { InitializeEmptyExtensionService(); - InitializeProcessManager(); InitializeExtensionSyncService(); InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); const Extension* extension = service()->GetInstalledExtension(good_crx); @@ -5880,7 +5877,6 @@ TEST_F(ExtensionServiceTest, ProcessSyncDataWrongType) { TEST_F(ExtensionServiceTest, ProcessSyncDataSettings) { InitializeEmptyExtensionService(); - InitializeProcessManager(); InitializeExtensionSyncService(); syncer::FakeSyncChangeProcessor processor; extension_sync_service()->MergeDataAndStartSyncing( diff --git a/chrome/browser/extensions/extension_system_factory.cc b/chrome/browser/extensions/extension_system_factory.cc index 503b37a..4495d7e 100644 --- a/chrome/browser/extensions/extension_system_factory.cc +++ b/chrome/browser/extensions/extension_system_factory.cc @@ -13,6 +13,7 @@ #include "extensions/browser/extension_registry_factory.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/extensions_browser_client.h" +#include "extensions/browser/process_manager_factory.h" #include "extensions/browser/renderer_startup_helper.h" namespace extensions { @@ -42,6 +43,7 @@ ExtensionSystemSharedFactory::ExtensionSystemSharedFactory() DependsOn(ExtensionRegistryFactory::GetInstance()); DependsOn(GlobalErrorServiceFactory::GetInstance()); DependsOn(policy::ProfilePolicyConnectorFactory::GetInstance()); + DependsOn(ProcessManagerFactory::GetInstance()); DependsOn(RendererStartupHelperFactory::GetInstance()); } diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc index 6e08e4b..11d69fe 100644 --- a/chrome/browser/extensions/extension_system_impl.cc +++ b/chrome/browser/extensions/extension_system_impl.cc @@ -52,7 +52,6 @@ #include "extensions/browser/info_map.h" #include "extensions/browser/lazy_background_task_queue.h" #include "extensions/browser/management_policy.h" -#include "extensions/browser/process_manager.h" #include "extensions/browser/quota_service.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/state_store.h" @@ -515,9 +514,7 @@ ExtensionSystemImpl::ExtensionSystemImpl(Profile* profile) : profile_(profile) { shared_ = ExtensionSystemSharedFactory::GetForBrowserContext(profile); - if (profile->IsOffTheRecord()) { - process_manager_.reset(ProcessManager::Create(profile)); - } else { + if (!profile->IsOffTheRecord()) { shared_->InitPrefs(); } } @@ -526,7 +523,6 @@ ExtensionSystemImpl::~ExtensionSystemImpl() { } void ExtensionSystemImpl::Shutdown() { - process_manager_.reset(); } void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) { @@ -536,9 +532,6 @@ void ExtensionSystemImpl::InitForRegularProfile(bool extensions_enabled) { // The InfoMap needs to be created before the ProcessManager. shared_->info_map(); - - process_manager_.reset(ProcessManager::Create(profile_)); - shared_->Init(extensions_enabled); } @@ -558,10 +551,6 @@ SharedUserScriptMaster* ExtensionSystemImpl::shared_user_script_master() { return shared_->shared_user_script_master(); } -ProcessManager* ExtensionSystemImpl::process_manager() { - return process_manager_.get(); -} - StateStore* ExtensionSystemImpl::state_store() { return shared_->state_store(); } diff --git a/chrome/browser/extensions/extension_system_impl.h b/chrome/browser/extensions/extension_system_impl.h index b076464..9961fce 100644 --- a/chrome/browser/extensions/extension_system_impl.h +++ b/chrome/browser/extensions/extension_system_impl.h @@ -41,7 +41,6 @@ class ExtensionSystemImpl : public ExtensionSystem { ManagementPolicy* management_policy() override; // shared // shared SharedUserScriptMaster* shared_user_script_master() override; - ProcessManager* process_manager() override; StateStore* state_store() override; // shared StateStore* rules_store() override; // shared LazyBackgroundTaskQueue* lazy_background_task_queue() override; // shared @@ -156,12 +155,6 @@ class ExtensionSystemImpl : public ExtensionSystem { Shared* shared_; - // |process_manager_| must be destroyed before the Profile's |io_data_|. While - // |process_manager_| still lives, we handle incoming resource requests from - // extension processes and those require access to the ResourceContext owned - // by |io_data_|. - scoped_ptr<ProcessManager> process_manager_; - DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); }; diff --git a/chrome/browser/extensions/extension_test_notification_observer.cc b/chrome/browser/extensions/extension_test_notification_observer.cc index f79168e..32d30d3 100644 --- a/chrome/browser/extensions/extension_test_notification_observer.cc +++ b/chrome/browser/extensions/extension_test_notification_observer.cc @@ -139,7 +139,7 @@ bool ExtensionTestNotificationObserver::WaitForPageActionVisibilityChangeTo( bool ExtensionTestNotificationObserver::WaitForExtensionViewsToLoad() { extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(GetProfile())->process_manager(); + extensions::ProcessManager::Get(GetProfile()); NotificationSet notification_set; notification_set.Add(content::NOTIFICATION_WEB_CONTENTS_DESTROYED); notification_set.Add(content::NOTIFICATION_LOAD_STOP); diff --git a/chrome/browser/extensions/extension_util.cc b/chrome/browser/extensions/extension_util.cc index e02b658..6e33a9a 100644 --- a/chrome/browser/extensions/extension_util.cc +++ b/chrome/browser/extensions/extension_util.cc @@ -255,10 +255,6 @@ bool ShouldSyncApp(const Extension* app, content::BrowserContext* context) { bool IsExtensionIdle(const std::string& extension_id, content::BrowserContext* context) { - ProcessManager* process_manager = - ExtensionSystem::Get(context)->process_manager(); - DCHECK(process_manager); - std::vector<std::string> ids_to_check; ids_to_check.push_back(extension_id); @@ -280,6 +276,7 @@ bool IsExtensionIdle(const std::string& extension_id, } } + ProcessManager* process_manager = ProcessManager::Get(context); for (std::vector<std::string>::const_iterator i = ids_to_check.begin(); i != ids_to_check.end(); i++) { diff --git a/chrome/browser/extensions/extension_view_host_factory.cc b/chrome/browser/extensions/extension_view_host_factory.cc index 2b92644..db04a28 100644 --- a/chrome/browser/extensions/extension_view_host_factory.cc +++ b/chrome/browser/extensions/extension_view_host_factory.cc @@ -34,9 +34,8 @@ ExtensionViewHost* CreateViewHostForExtension(const Extension* extension, DCHECK(profile); // A NULL browser may only be given for dialogs. DCHECK(browser || view_type == VIEW_TYPE_EXTENSION_DIALOG); - ProcessManager* pm = - ExtensionSystem::Get(profile)->process_manager(); - content::SiteInstance* site_instance = pm->GetSiteInstanceForURL(url); + content::SiteInstance* site_instance = + ProcessManager::Get(profile)->GetSiteInstanceForURL(url); ExtensionViewHost* host = #if defined(OS_MACOSX) new ExtensionViewHostMac(extension, site_instance, url, view_type); diff --git a/chrome/browser/extensions/gpu_browsertest.cc b/chrome/browser/extensions/gpu_browsertest.cc index cc4a5af..44bc1fd 100644 --- a/chrome/browser/extensions/gpu_browsertest.cc +++ b/chrome/browser/extensions/gpu_browsertest.cc @@ -7,7 +7,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/common/web_preferences.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" // Tests that background pages are marked as never visible to prevent GPU @@ -19,7 +18,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, BackgroundPageIsNeverVisible) { .AppendASCII("1.0.0.0"))); extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ExtensionHost* host = FindHostWithPath(manager, "/backgroundpage.html", 1); ASSERT_TRUE(host->host_contents()->GetDelegate()->IsNeverVisible( diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index 509db41..5abc756 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -8,7 +8,6 @@ #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/extensions/browser_action_test_util.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/lazy_background_page_test_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -26,7 +25,6 @@ #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry_observer.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/extension.h" #include "extensions/test/extension_test_message_listener.h" @@ -107,8 +105,8 @@ class LazyBackgroundPageApiTest : public ExtensionApiTest { // Returns true if the lazy background page for the extension with // |extension_id| is still running. bool IsBackgroundPageAlive(const std::string& extension_id) { - extensions::ProcessManager* pm = extensions::ExtensionSystem::Get( - browser()->profile())->process_manager(); + extensions::ProcessManager* pm = + extensions::ProcessManager::Get(browser()->profile()); return pm->GetBackgroundHostForExtension(extension_id); } @@ -226,7 +224,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForDialog) { // Close the dialog. The keep alive count is decremented. extensions::ProcessManager* pm = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); int previous_keep_alive_count = pm->GetLazyKeepaliveCount(extension); dialog->CloseModalDialog(); EXPECT_EQ(previous_keep_alive_count - 1, @@ -282,7 +280,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForRequest) { // Lazy Background Page still exists, because the extension started a request. extensions::ProcessManager* pm = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ExtensionHost* host = pm->GetBackgroundHostForExtension(last_loaded_extension_id()); ASSERT_TRUE(host); @@ -350,10 +348,9 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, DISABLED_IncognitoSplitMode) { // Lazy Background Page doesn't exist yet. extensions::ProcessManager* pm = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ProcessManager* pmi = - extensions::ExtensionSystem::Get(incognito_browser->profile())-> - process_manager(); + extensions::ProcessManager::Get(incognito_browser->profile()); EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); EXPECT_FALSE(pmi->GetBackgroundHostForExtension(last_loaded_extension_id())); @@ -440,7 +437,7 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, ImpulseAddsCount) { // Lazy Background Page doesn't exist yet. extensions::ProcessManager* pm = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); EXPECT_EQ(1, browser()->tab_strip_model()->count()); diff --git a/chrome/browser/extensions/notifications_apitest.cc b/chrome/browser/extensions/notifications_apitest.cc index f846f8d..b375141 100644 --- a/chrome/browser/extensions/notifications_apitest.cc +++ b/chrome/browser/extensions/notifications_apitest.cc @@ -56,7 +56,6 @@ IN_PROC_BROWSER_TEST_F(NotificationIdleTest, MAYBE_NotificationsAllowUnload) { ASSERT_TRUE(extension) << message_; // Lazy Background Page has been shut down. - extensions::ProcessManager* pm = - extensions::ExtensionSystem::Get(profile())->process_manager(); + extensions::ProcessManager* pm = extensions::ProcessManager::Get(profile()); EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id())); } diff --git a/chrome/browser/extensions/permission_messages_unittest.cc b/chrome/browser/extensions/permission_messages_unittest.cc index 71aae76..f78ebd5 100644 --- a/chrome/browser/extensions/permission_messages_unittest.cc +++ b/chrome/browser/extensions/permission_messages_unittest.cc @@ -45,7 +45,6 @@ class PermissionMessagesUnittest : public ExtensionServiceTestBase { virtual void SetUp() override { ExtensionServiceTestBase::SetUp(); InitializeExtensionService(CreateDefaultInitParams()); - InitializeProcessManager(); } protected: diff --git a/chrome/browser/extensions/process_management_browsertest.cc b/chrome/browser/extensions/process_management_browsertest.cc index 416ff86..16f4aab 100644 --- a/chrome/browser/extensions/process_management_browsertest.cc +++ b/chrome/browser/extensions/process_management_browsertest.cc @@ -16,7 +16,6 @@ #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/switches.h" #include "net/dns/mock_host_resolver.h" @@ -141,8 +140,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ProcessOverflow) { // Get extension processes. extensions::ProcessManager* process_manager = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager(); + extensions::ProcessManager::Get(browser()->profile()); content::RenderProcessHost* extension1_host = process_manager->GetSiteInstanceForURL(extension1_url)->GetProcess(); content::RenderProcessHost* extension2_host = @@ -232,8 +230,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ExtensionProcessBalancing) { std::set<int> process_ids; Profile* profile = browser()->profile(); - extensions::ProcessManager* epm = extensions::ExtensionSystem::Get(profile)-> - process_manager(); + extensions::ProcessManager* epm = extensions::ProcessManager::Get(profile); for (extensions::ProcessManager::const_iterator iter = epm->background_hosts().begin(); iter != epm->background_hosts().end(); ++iter) { diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc index 2395966..9f2495b 100644 --- a/chrome/browser/extensions/process_manager_browsertest.cc +++ b/chrome/browser/extensions/process_manager_browsertest.cc @@ -13,7 +13,6 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" #include "content/public/test/test_utils.h" -#include "extensions/browser/extension_system.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -27,7 +26,7 @@ typedef ExtensionBrowserTest ProcessManagerBrowserTest; // and background pages. IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, ExtensionHostCreation) { - ProcessManager* pm = ExtensionSystem::Get(profile())->process_manager(); + ProcessManager* pm = ProcessManager::Get(profile()); // We start with no background hosts. ASSERT_EQ(0u, pm->background_hosts().size()); @@ -68,7 +67,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, // Disabled due to flake, see http://crbug.com/315242 IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, DISABLED_PopupHostCreation) { - ProcessManager* pm = ExtensionSystem::Get(profile())->process_manager(); + ProcessManager* pm = ProcessManager::Get(profile()); // Load an extension with the ability to open a popup but no background // page. @@ -111,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, // interact with an installed extension with that ID. Regression test // for bug 357382. IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, HttpHostMatchingExtensionId) { - ProcessManager* pm = ExtensionSystem::Get(profile())->process_manager(); + ProcessManager* pm = ProcessManager::Get(profile()); // We start with no background hosts. ASSERT_EQ(0u, pm->background_hosts().size()); diff --git a/chrome/browser/extensions/test_extension_system.cc b/chrome/browser/extensions/test_extension_system.cc index 03ed910..0f513e4 100644 --- a/chrome/browser/extensions/test_extension_system.cc +++ b/chrome/browser/extensions/test_extension_system.cc @@ -26,7 +26,6 @@ #include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/info_map.h" #include "extensions/browser/management_policy.h" -#include "extensions/browser/process_manager.h" #include "extensions/browser/quota_service.h" #include "extensions/browser/runtime_data.h" #include "extensions/browser/state_store.h" @@ -49,15 +48,6 @@ TestExtensionSystem::~TestExtensionSystem() { void TestExtensionSystem::Shutdown() { if (extension_service_) extension_service_->Shutdown(); - process_manager_.reset(); -} - -void TestExtensionSystem::CreateProcessManager() { - process_manager_.reset(ProcessManager::Create(profile_)); -} - -void TestExtensionSystem::SetProcessManager(ProcessManager* manager) { - process_manager_.reset(manager); } ExtensionPrefs* TestExtensionSystem::CreateExtensionPrefs( @@ -135,10 +125,6 @@ SharedUserScriptMaster* TestExtensionSystem::shared_user_script_master() { return NULL; } -ProcessManager* TestExtensionSystem::process_manager() { - return process_manager_.get(); -} - StateStore* TestExtensionSystem::state_store() { return state_store_.get(); } diff --git a/chrome/browser/extensions/test_extension_system.h b/chrome/browser/extensions/test_extension_system.h index 6ff0da8..81d0370 100644 --- a/chrome/browser/extensions/test_extension_system.h +++ b/chrome/browser/extensions/test_extension_system.h @@ -51,13 +51,6 @@ class TestExtensionSystem : public ExtensionSystem { const base::FilePath& install_directory, bool autoupdate_enabled); - // Creates a ProcessManager. If not invoked, the ProcessManager is NULL. - void CreateProcessManager(); - - // Allows the ProcessManager to be overriden, for example by a stub - // implementation. Takes ownership of |manager|. - void SetProcessManager(ProcessManager* manager); - void CreateSocketManager(); void InitForRegularProfile(bool extensions_enabled) override {} @@ -66,7 +59,6 @@ class TestExtensionSystem : public ExtensionSystem { RuntimeData* runtime_data() override; ManagementPolicy* management_policy() override; SharedUserScriptMaster* shared_user_script_master() override; - ProcessManager* process_manager() override; StateStore* state_store() override; StateStore* rules_store() override; TestingValueStore* value_store() { return value_store_; } @@ -105,7 +97,6 @@ class TestExtensionSystem : public ExtensionSystem { scoped_ptr<ManagementPolicy> management_policy_; scoped_ptr<RuntimeData> runtime_data_; scoped_ptr<ExtensionService> extension_service_; - scoped_ptr<ProcessManager> process_manager_; scoped_refptr<InfoMap> info_map_; scoped_ptr<EventRouter> event_router_; scoped_ptr<ErrorConsole> error_console_; diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc index d0a0c0c..a626e16 100644 --- a/chrome/browser/extensions/window_open_apitest.cc +++ b/chrome/browser/extensions/window_open_apitest.cc @@ -23,7 +23,6 @@ #include "content/public/common/url_constants.h" #include "content/public/test/browser_test_utils.h" #include "extensions/browser/extension_host.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" @@ -399,8 +398,8 @@ IN_PROC_BROWSER_TEST_F(WindowOpenPanelTest, ClosePanelsOnExtensionCrash) { // Crash the extension. extensions::ExtensionHost* extension_host = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager()->GetBackgroundHostForExtension(extension->id()); + extensions::ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(extension->id()); ASSERT_TRUE(extension_host); base::KillProcess(extension_host->render_process_host()->GetHandle(), content::RESULT_CODE_KILLED, false); diff --git a/chrome/browser/net/chrome_extensions_network_delegate.cc b/chrome/browser/net/chrome_extensions_network_delegate.cc index 2932d7a..c551584 100644 --- a/chrome/browser/net/chrome_extensions_network_delegate.cc +++ b/chrome/browser/net/chrome_extensions_network_delegate.cc @@ -15,7 +15,6 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/resource_request_info.h" #include "extensions/browser/api/web_request/web_request_api.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/info_map.h" #include "extensions/browser/process_manager.h" #include "net/url_request/url_request.h" @@ -39,10 +38,8 @@ void NotifyEPMRequestStatus(RequestStatus status, return; extensions::ProcessManager* process_manager = - extensions::ExtensionSystem::Get(profile)->process_manager(); - // This may be NULL in unit tests. - if (!process_manager) - return; + extensions::ProcessManager::Get(profile); + DCHECK(process_manager); // Will be NULL if the request was not issued on behalf of a renderer (e.g. a // system-level request). diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 1b369fb..d0b81ed 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -1785,7 +1785,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) { // Wait until any background pages belonging to force-installed extensions // have been loaded. extensions::ProcessManager* manager = - extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + extensions::ProcessManager::Get(browser()->profile()); extensions::ProcessManager::ViewSet all_views = manager->GetAllViews(); for (extensions::ProcessManager::ViewSet::const_iterator iter = all_views.begin(); @@ -1816,8 +1816,8 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallForcelist) { extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::NotificationService::AllSources()); extensions::ExtensionHost* extension_host = - extensions::ExtensionSystem::Get(browser()->profile())-> - process_manager()->GetBackgroundHostForExtension(kGoodCrxId); + extensions::ProcessManager::Get(browser()->profile()) + ->GetBackgroundHostForExtension(kGoodCrxId); base::KillProcess(extension_host->render_process_host()->GetHandle(), content::RESULT_CODE_KILLED, false); extension_crashed_observer.Wait(); diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index de55523..7841aa6 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -627,14 +627,9 @@ void RenderViewContextMenu::AppendPrintPreviewItems() { } const Extension* RenderViewContextMenu::GetExtension() const { - extensions::ExtensionSystem* system = - extensions::ExtensionSystem::Get(browser_context_); - // There is no process manager in some tests. - if (!system->process_manager()) - return NULL; - - return system->process_manager()->GetExtensionForRenderViewHost( - source_web_contents_->GetRenderViewHost()); + return extensions::ProcessManager::Get(browser_context_) + ->GetExtensionForRenderViewHost( + source_web_contents_->GetRenderViewHost()); } void RenderViewContextMenu::AppendDeveloperItems() { diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc index 4a89f59..6db90be 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc +++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc @@ -54,10 +54,9 @@ void WarnIfMissingPauseOrResumeListener( if (has_onpause == has_onresume) return; - extensions::ProcessManager* process_manager = - ExtensionSystem::Get(profile)->process_manager(); extensions::ExtensionHost* host = - process_manager->GetBackgroundHostForExtension(extension_id); + extensions::ProcessManager::Get(profile) + ->GetBackgroundHostForExtension(extension_id); host->render_process_host()->Send(new ExtensionMsg_AddMessageToConsole( host->render_view_host()->GetRoutingID(), content::CONSOLE_MESSAGE_LEVEL_WARNING, diff --git a/chrome/browser/task_manager/extension_information.cc b/chrome/browser/task_manager/extension_information.cc index ab22d23..6dcf014 100644 --- a/chrome/browser/task_manager/extension_information.cc +++ b/chrome/browser/task_manager/extension_information.cc @@ -15,7 +15,6 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/guest_view/guest_view_base.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/view_type_utils.h" @@ -31,12 +30,8 @@ using extensions::Extension; namespace { const Extension* GetExtensionForWebContents(WebContents* web_contents) { - Profile* profile = - Profile::FromBrowserContext(web_contents->GetBrowserContext()); - extensions::ProcessManager* process_manager = - extensions::ExtensionSystem::Get(profile)->process_manager(); - return process_manager->GetExtensionForRenderViewHost( - web_contents->GetRenderViewHost()); + return extensions::ProcessManager::Get(web_contents->GetBrowserContext()) + ->GetExtensionForRenderViewHost(web_contents->GetRenderViewHost()); } } // namespace @@ -129,18 +124,13 @@ void ExtensionInformation::GetAll(const NewWebContentsCallback& callback) { } for (size_t i = 0; i < profiles.size(); ++i) { - extensions::ProcessManager* process_manager = - extensions::ExtensionSystem::Get(profiles[i])->process_manager(); - if (process_manager) { - const extensions::ProcessManager::ViewSet all_views = - process_manager->GetAllViews(); - extensions::ProcessManager::ViewSet::const_iterator jt = - all_views.begin(); - for (; jt != all_views.end(); ++jt) { - WebContents* web_contents = WebContents::FromRenderViewHost(*jt); - if (CheckOwnership(web_contents)) - callback.Run(web_contents); - } + const extensions::ProcessManager::ViewSet all_views = + extensions::ProcessManager::Get(profiles[i])->GetAllViews(); + extensions::ProcessManager::ViewSet::const_iterator jt = all_views.begin(); + for (; jt != all_views.end(); ++jt) { + WebContents* web_contents = WebContents::FromRenderViewHost(*jt); + if (CheckOwnership(web_contents)) + callback.Run(web_contents); } } } diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc index f51a947..4f207d4 100644 --- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc +++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc @@ -1448,8 +1448,6 @@ TEST_F(TranslateManagerRenderViewHostTest, BeforeTranslateExtraButtons) { translate::TranslateInfoBarDelegate* infobar; TestingProfile* test_profile = static_cast<TestingProfile*>(web_contents()->GetBrowserContext()); - static_cast<extensions::TestExtensionSystem*>( - extensions::ExtensionSystem::Get(test_profile))->CreateProcessManager(); test_profile->ForceIncognito(true); for (int i = 0; i < 8; ++i) { SCOPED_TRACE(::testing::Message() << "Iteration " << i << " incognito mode=" diff --git a/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc b/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc index d6c74a8..4b770cc 100644 --- a/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc +++ b/chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.cc @@ -21,8 +21,8 @@ #include "ui/base/l10n/l10n_util.h" #if defined(ENABLE_EXTENSIONS) -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" +#include "extensions/common/extension.h" #endif // defined(ENABLE_EXTENSIONS) using content::BrowserContext; @@ -39,8 +39,7 @@ namespace { // Returns the ProcessManager for the browser context from |web_contents|. extensions::ProcessManager* GetExtensionsProcessManager( WebContents* web_contents) { - return extensions::ExtensionSystem::Get( - web_contents->GetBrowserContext())->process_manager(); + return extensions::ProcessManager::Get(web_contents->GetBrowserContext()); } // Returns the extension associated with |web_contents| or NULL if there is no diff --git a/chrome/browser/ui/ash/media_delegate_chromeos.cc b/chrome/browser/ui/ash/media_delegate_chromeos.cc index 20f4ea3..53cc92f 100644 --- a/chrome/browser/ui/ash/media_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/media_delegate_chromeos.cc @@ -19,7 +19,6 @@ #include "content/public/browser/web_contents.h" #include "extensions/browser/app_window/app_window.h" #include "extensions/browser/app_window/app_window_registry.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/process_manager.h" namespace { @@ -77,10 +76,8 @@ void GetExtensionMediaCaptureState( const MediaStreamCaptureIndicator* indicator, content::BrowserContext* context, int* media_state_out) { - extensions::ProcessManager* process_manager = - extensions::ExtensionSystem::Get(context)->process_manager(); const extensions::ProcessManager::ViewSet view_set = - process_manager->GetAllViews(); + extensions::ProcessManager::Get(context)->GetAllViews(); for (extensions::ProcessManager::ViewSet::const_iterator iter = view_set.begin(); iter != view_set.end(); diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc index bc97cf2..f4cb961 100644 --- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc +++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc @@ -1371,7 +1371,7 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension( // Get the extension process's active views. extensions::ProcessManager* process_manager = - ExtensionSystem::Get(extension_service_->profile())->process_manager(); + ProcessManager::Get(extension_service_->profile()); GetInspectablePagesForExtensionProcess( extension, process_manager->GetRenderViewHostsForExtension(extension->id()), @@ -1399,9 +1399,8 @@ ExtensionSettingsHandler::GetInspectablePagesForExtension( IncognitoInfo::IsSplitMode(extension) && util::IsIncognitoEnabled(extension->id(), extension_service_->profile())) { - extensions::ProcessManager* process_manager = - ExtensionSystem::Get(extension_service_->profile()-> - GetOffTheRecordProfile())->process_manager(); + extensions::ProcessManager* process_manager = ProcessManager::Get( + extension_service_->profile()->GetOffTheRecordProfile()); GetInspectablePagesForExtensionProcess( extension, process_manager->GetRenderViewHostsForExtension(extension->id()), |