diff options
Diffstat (limited to 'chrome/browser/extensions')
23 files changed, 133 insertions, 112 deletions
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc index 75f57b5..05be15b 100644 --- a/chrome/browser/extensions/app_process_apitest.cc +++ b/chrome/browser/extensions/app_process_apitest.cc @@ -105,7 +105,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { browser(), base_url.Resolve("path1/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(1)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(1)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(1)->web_ui()); LOG(INFO) << "Nav 1."; @@ -113,7 +113,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { browser(), base_url.Resolve("path2/empty.html"), NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(2)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(2)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(2)->web_ui()); LOG(INFO) << "Nav 2."; @@ -126,7 +126,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path3/empty.html")); LOG(INFO) << "Nav 3."; EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(3)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(3)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(3)->web_ui()); // We should have opened 3 new extension tabs. Including the original blank @@ -217,7 +217,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); LOG(INFO) << "Nav 1."; EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(1)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(1)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(1)->web_ui()); ui_test_utils::WindowedNotificationObserver tab_added_observer( @@ -229,7 +229,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessInstances) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path2/empty.html")); LOG(INFO) << "Nav 2."; EXPECT_TRUE(process_map->Contains( - browser()->GetTabContentsAt(2)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(2)->render_view_host()->process()->GetID())); EXPECT_FALSE(browser()->GetTabContentsAt(2)->web_ui()); // We should have opened 2 new extension tabs. Including the original blank @@ -308,7 +308,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); TabContents* contents = browser()->GetTabContentsAt(0); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Load app and navigate to the page. const Extension* app = @@ -316,13 +316,13 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { ASSERT_TRUE(app); ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Disable app and navigate to the page. DisableExtension(app->id()); ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Enable app and reload the page. EnableExtension(app->id()); @@ -333,7 +333,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { browser()->Reload(CURRENT_TAB); reload_observer.Wait(); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Disable app and reload the page. DisableExtension(app->id()); @@ -344,7 +344,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { browser()->Reload(CURRENT_TAB); reload_observer2.Wait(); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Enable app and reload via JavaScript. EnableExtension(app->id()); @@ -356,7 +356,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { L"", L"location.reload();")); js_reload_observer.Wait(); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); // Disable app and reload via JavaScript. DisableExtension(app->id()); @@ -368,7 +368,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, DISABLED_ReloadIntoAppProcess) { L"", L"location.reload();")); js_reload_observer2.Wait(); EXPECT_FALSE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); } // Tests that if we have a non-app process (path3/container.html) that has an @@ -399,7 +399,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION | ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); EXPECT_FALSE(process_map->Contains( - browser()->GetTabContentsAt(0)->render_view_host()->process()->id())); + browser()->GetTabContentsAt(0)->render_view_host()->process()->GetID())); // Wait for popup window to appear. GURL app_url = base_url.Resolve("path1/empty.html"); @@ -422,7 +422,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenAppFromIframe) { // Popup window should be in the app's process. EXPECT_TRUE(process_map->Contains( last_active_browser->GetTabContentsAt(0)->render_view_host()->process()-> - id())); + GetID())); } // Tests that if we have an app process (path1/container.html) with a non-app @@ -457,9 +457,9 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION | ui_test_utils::BROWSER_TEST_WAIT_FOR_BROWSER); - RenderProcessHost* process = + content::RenderProcessHost* process = browser()->GetTabContentsAt(0)->render_view_host()->process(); - EXPECT_TRUE(process_map->Contains(process->id())); + EXPECT_TRUE(process_map->Contains(process->GetID())); // Wait for popup window to appear. The new Browser may not have been // added with SetLastActive, in which case we need to show it first. @@ -479,7 +479,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, OpenWebPopupFromWebIframe) { observer.Wait(); // Popup window should be in the app's process. - RenderProcessHost* popup_process = + content::RenderProcessHost* popup_process = last_active_browser->GetTabContentsAt(0)->render_view_host()->process(); EXPECT_EQ(process, popup_process); } @@ -499,7 +499,7 @@ IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); TabContents* contents = browser()->GetTabContentsAt(0); EXPECT_TRUE(process_map->Contains( - contents->render_view_host()->process()->id())); + contents->render_view_host()->process()->GetID())); bool is_installed = false; ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( contents->render_view_host(), L"", diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc index 83f032f..bca31e4 100644 --- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc +++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc @@ -17,9 +17,9 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { @@ -72,7 +72,7 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { GetBackgroundHostForExtension(extension_id); ASSERT_TRUE(extension_host); - RenderProcessHost* extension_rph = + content::RenderProcessHost* extension_rph = extension_host->render_view_host()->process(); base::KillProcess(extension_rph->GetHandle(), content::RESULT_CODE_KILLED, false); @@ -94,7 +94,8 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest { extensions::ProcessMap* process_map = browser()->profile()->GetExtensionService()->process_map(); ASSERT_TRUE(process_map->Contains( - extension->id(), extension_host->render_view_host()->process()->id())); + extension->id(), extension_host->render_view_host()->process()-> + GetID())); } void LoadTestExtension() { diff --git a/chrome/browser/extensions/extension_event_router.cc b/chrome/browser/extensions/extension_event_router.cc index 73c7db2..54336ee 100644 --- a/chrome/browser/extensions/extension_event_router.cc +++ b/chrome/browser/extensions/extension_event_router.cc @@ -22,8 +22,8 @@ #include "chrome/common/extensions/extension_messages.h" #include "chrome/common/extensions/api/extension_api.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; using extensions::ExtensionAPI; @@ -43,10 +43,11 @@ void NotifyEventListenerRemovedOnIOThread( } // namespace struct ExtensionEventRouter::EventListener { - RenderProcessHost* process; + content::RenderProcessHost* process; std::string extension_id; - EventListener(RenderProcessHost* process, const std::string& extension_id) + EventListener(content::RenderProcessHost* process, + const std::string& extension_id) : process(process), extension_id(extension_id) {} bool operator<(const EventListener& that) const { @@ -109,14 +110,15 @@ ExtensionEventRouter::~ExtensionEventRouter() {} void ExtensionEventRouter::AddEventListener( const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id) { EventListener listener(process, extension_id); DCHECK_EQ(listeners_[event_name].count(listener), 0u) << event_name; listeners_[event_name].insert(listener); if (extension_devtools_manager_.get()) - extension_devtools_manager_->AddEventListener(event_name, process->id()); + extension_devtools_manager_->AddEventListener(event_name, + process->GetID()); // We lazily tell the TaskManager to start updating when listeners to the // processes.onUpdated event arrive. @@ -126,18 +128,19 @@ void ExtensionEventRouter::AddEventListener( void ExtensionEventRouter::RemoveEventListener( const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id) { EventListener listener(process, extension_id); DCHECK_EQ(listeners_[event_name].count(listener), 1u) << - " PID=" << process->id() << " extension=" << extension_id << + " PID=" << process->GetID() << " extension=" << extension_id << " event=" << event_name; listeners_[event_name].erase(listener); // Note: extension_id may point to data in the now-deleted listeners_ object. // Do not use. if (extension_devtools_manager_.get()) - extension_devtools_manager_->RemoveEventListener(event_name, process->id()); + extension_devtools_manager_->RemoveEventListener(event_name, + process->GetID()); // If a processes.onUpdated event listener is removed (or a process with one // exits), then we let the TaskManager know that it has one fewer listener. @@ -273,14 +276,13 @@ void ExtensionEventRouter::DispatchEventImpl( continue; Profile* listener_profile = Profile::FromBrowserContext( - listener->process->browser_context()); + listener->process->GetBrowserContext()); extensions::ProcessMap* process_map = listener_profile->GetExtensionService()->process_map(); - // If the event is privileged, only send to extension processes. Otherwise, // it's OK to send to normal renderers (e.g., for content scripts). if (ExtensionAPI::GetInstance()->IsPrivileged(event->event_name) && - !process_map->Contains(extension->id(), listener->process->id())) { + !process_map->Contains(extension->id(), listener->process->GetID())) { continue; } @@ -366,8 +368,8 @@ void ExtensionEventRouter::Observe( switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - RenderProcessHost* renderer = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* renderer = + content::Source<content::RenderProcessHost>(source).ptr(); // Remove all event listeners associated with this renderer for (ListenerMap::iterator it = listeners_.begin(); it != listeners_.end(); ) { diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h index ade675e..cc2608d 100644 --- a/chrome/browser/extensions/extension_event_router.h +++ b/chrome/browser/extensions/extension_event_router.h @@ -21,7 +21,10 @@ class GURL; class Extension; class ExtensionDevToolsManager; class Profile; + +namespace content { class RenderProcessHost; +} class ExtensionEventRouter : public content::NotificationObserver { public: @@ -41,10 +44,10 @@ class ExtensionEventRouter : public content::NotificationObserver { // collapsing. Also, a single extension can have 2 processes if it is a split // mode extension. void AddEventListener(const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id); void RemoveEventListener(const std::string& event_name, - RenderProcessHost* process, + content::RenderProcessHost* process, const std::string& extension_id); // Returns true if there is at least one listener for the given event. diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index b66e898..b102d88d 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -33,10 +33,10 @@ #include "chrome/common/extensions/file_browser_handler.h" #include "chrome/common/pref_names.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "grit/platform_locale_settings.h" @@ -443,7 +443,7 @@ bool RequestLocalFileSystemFunction::RunImpl() { &RequestLocalFileSystemFunction::RequestOnFileThread, this, source_url_, - render_view_host()->process()->id())); + render_view_host()->process()->GetID())); // Will finish asynchronously. return true; } @@ -722,9 +722,9 @@ class ExecuteTasksFileBrowserFunction::ExecuteTasksFileSystemCallbackDispatcher SiteInstance* site_instance = manager->GetSiteInstanceForURL(extension_url); if (!site_instance || !site_instance->HasProcess()) return; - RenderProcessHost* process = site_instance->GetProcess(); + content::RenderProcessHost* process = site_instance->GetProcess(); - target_process_id_ = process->id(); + target_process_id_ = process->GetID(); } // Checks legitimacy of file url and grants file RO access permissions from @@ -882,7 +882,7 @@ void ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread( new ExecuteTasksFileSystemCallbackDispatcher( this, profile(), - render_view_host()->process()->id(), + render_view_host()->process()->GetID(), source_url, GetExtension(), task_id, diff --git a/chrome/browser/extensions/extension_function.cc b/chrome/browser/extensions/extension_function.cc index c4a502f..c87c15a 100644 --- a/chrome/browser/extensions/extension_function.cc +++ b/chrome/browser/extensions/extension_function.cc @@ -11,11 +11,11 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/chrome_render_message_filter.h" #include "chrome/common/extensions/extension_messages.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/user_metrics.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "content/public/common/result_codes.h" using content::BrowserThread; @@ -116,7 +116,7 @@ void ExtensionFunction::SendResponseImpl(base::ProcessHandle process, void ExtensionFunction::HandleBadMessage(base::ProcessHandle process) { LOG(ERROR) << "bad extension message " << name_ << " : terminating renderer."; - if (RenderProcessHost::run_renderer_in_process()) { + if (content::RenderProcessHost::run_renderer_in_process()) { // In single process mode it is better if we don't suicide but just crash. CHECK(false); } else { diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index c94b277..2482a0a 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -581,7 +581,7 @@ Browser* ExtensionFunctionDispatcher::GetCurrentBrowser( // we will search the incognito version only, regardless of the value of // |include_incognito|. Profile* profile = Profile::FromBrowserContext( - render_view_host->process()->browser_context()); + render_view_host->process()->GetBrowserContext()); browser = BrowserList::FindTabbedBrowser(profile, include_incognito); // NOTE(rafaelw): This can return NULL in some circumstances. In particular, @@ -608,7 +608,7 @@ void ExtensionFunctionDispatcher::Dispatch( scoped_refptr<ExtensionFunction> function( CreateExtensionFunction(params, extension, - render_view_host->process()->id(), + render_view_host->process()->GetID(), *(service->process_map()), profile(), render_view_host, render_view_host->routing_id())); diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 6c97feb..36743e3 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -31,12 +31,11 @@ #include "chrome/common/url_constants.h" #include "chrome/common/chrome_view_types.h" #include "content/browser/browsing_instance.h" -#include "content/browser/renderer_host/browser_render_process_host.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/content_browser_client.h" #include "content/public/browser/native_web_keyboard_event.h" #include "grit/browser_resources.h" @@ -185,7 +184,7 @@ TabContents* ExtensionHost::GetAssociatedTabContents() const { return associated_tab_contents_; } -RenderProcessHost* ExtensionHost::render_process_host() const { +content::RenderProcessHost* ExtensionHost::render_process_host() const { return host_contents()->GetRenderProcessHost(); } diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h index 4475ade..c098376 100644 --- a/chrome/browser/extensions/extension_host.h +++ b/chrome/browser/extensions/extension_host.h @@ -29,12 +29,15 @@ class Browser; class Extension; -class RenderProcessHost; class RenderWidgetHostView; class TabContents; struct ViewHostMsg_RunFileChooser_Params; struct WebPreferences; +namespace content { +class RenderProcessHost; +} + // This class is the browser component of an extension component's RenderView. // It handles setting up the renderer process, if needed, with special // privileges available to extensions. It may have a view to be shown in the @@ -72,7 +75,7 @@ class ExtensionHost : public TabContentsDelegate, const std::string& extension_id() const { return extension_id_; } TabContents* host_contents() const { return host_contents_.get(); } RenderViewHost* render_view_host() const; - RenderProcessHost* render_process_host() const; + content::RenderProcessHost* render_process_host() const; bool did_stop_loading() const { return did_stop_loading_; } bool document_element_available() const { return document_element_available_; diff --git a/chrome/browser/extensions/extension_message_handler.cc b/chrome/browser/extensions/extension_message_handler.cc index f600fa5..6ba6e46 100644 --- a/chrome/browser/extensions/extension_message_handler.cc +++ b/chrome/browser/extensions/extension_message_handler.cc @@ -10,7 +10,7 @@ #include "content/browser/child_process_security_policy.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" ExtensionMessageHandler::ExtensionMessageHandler( RenderViewHost* render_view_host) @@ -38,7 +38,7 @@ void ExtensionMessageHandler::RenderViewHostInitialized() { void ExtensionMessageHandler::OnPostMessage(int port_id, const std::string& message) { Profile* profile = Profile::FromBrowserContext( - render_view_host()->process()->browser_context()); + render_view_host()->process()->GetBrowserContext()); if (profile->GetExtensionMessageService()) { profile->GetExtensionMessageService()->PostMessageFromRenderer( port_id, message); diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index d89b6e6..361c408 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -17,11 +17,11 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_messages.h" #include "content/browser/child_process_security_policy.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" // Since we have 2 ports for every channel, we just index channels by half the // port ID. @@ -94,7 +94,7 @@ static void DispatchOnMessage(const ExtensionMessageService::MessagePort& port, port.routing_id, target_port_id, message)); } -static RenderProcessHost* GetExtensionProcess(Profile* profile, +static content::RenderProcessHost* GetExtensionProcess(Profile* profile, const std::string& extension_id) { SiteInstance* site_instance = profile->GetExtensionProcessManager()->GetSiteInstanceForURL( @@ -153,10 +153,11 @@ void ExtensionMessageService::OpenChannelToExtension( const std::string& source_extension_id, const std::string& target_extension_id, const std::string& channel_name) { - RenderProcessHost* source = RenderProcessHost::FromID(source_process_id); + content::RenderProcessHost* source = + content::RenderProcessHost::FromID(source_process_id); if (!source) return; - Profile* profile = Profile::FromBrowserContext(source->browser_context()); + Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); // Note: we use the source's profile here. If the source is an incognito // process, we will use the incognito EPM to find the right extension process, @@ -183,10 +184,11 @@ void ExtensionMessageService::OpenChannelToTab( int source_process_id, int source_routing_id, int receiver_port_id, int tab_id, const std::string& extension_id, const std::string& channel_name) { - RenderProcessHost* source = RenderProcessHost::FromID(source_process_id); + content::RenderProcessHost* source = + content::RenderProcessHost::FromID(source_process_id); if (!source) return; - Profile* profile = Profile::FromBrowserContext(source->browser_context()); + Profile* profile = Profile::FromBrowserContext(source->GetBrowserContext()); TabContentsWrapper* contents = NULL; MessagePort receiver; @@ -345,8 +347,8 @@ void ExtensionMessageService::Observe( switch (type) { case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { - RenderProcessHost* renderer = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* renderer = + content::Source<content::RenderProcessHost>(source).ptr(); OnSenderClosed(renderer); break; } diff --git a/chrome/browser/extensions/extension_permissions_api.cc b/chrome/browser/extensions/extension_permissions_api.cc index b6ce293..bfc7116 100644 --- a/chrome/browser/extensions/extension_permissions_api.cc +++ b/chrome/browser/extensions/extension_permissions_api.cc @@ -218,10 +218,11 @@ void ExtensionPermissionsManager::NotifyPermissionsUpdated( content::Details<UpdatedExtensionPermissionsInfo>(&info)); // Send the new permissions to the renderers. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* host = i.GetCurrentValue(); - Profile* profile = Profile::FromBrowserContext(host->browser_context()); + content::RenderProcessHost* host = i.GetCurrentValue(); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); if (extension_service_->profile()->IsSameProfile(profile)) host->Send(new ExtensionMsg_UpdatePermissions( static_cast<int>(reason), diff --git a/chrome/browser/extensions/extension_permissions_api.h b/chrome/browser/extensions/extension_permissions_api.h index 22563b9..583302e 100644 --- a/chrome/browser/extensions/extension_permissions_api.h +++ b/chrome/browser/extensions/extension_permissions_api.h @@ -13,7 +13,7 @@ #include "chrome/browser/extensions/extension_install_ui.h" #include "chrome/common/extensions/extension_permission_set.h" #include "chrome/common/chrome_notification_types.h" -#include "content/browser/renderer_host/render_process_host.h" +#include "content/public/browser/render_process_host.h" class Extension; class ExtensionPermissionSet; diff --git a/chrome/browser/extensions/extension_processes_api.cc b/chrome/browser/extensions/extension_processes_api.cc index a35096f..5ca38b3 100644 --- a/chrome/browser/extensions/extension_processes_api.cc +++ b/chrome/browser/extensions/extension_processes_api.cc @@ -20,9 +20,9 @@ #include "chrome/browser/task_manager/task_manager.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/extensions/extension_error_utils.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" namespace keys = extension_processes_api_constants; diff --git a/chrome/browser/extensions/extension_save_page_api.cc b/chrome/browser/extensions/extension_save_page_api.cc index 7fb8416..2a934b2 100644 --- a/chrome/browser/extensions/extension_save_page_api.cc +++ b/chrome/browser/extensions/extension_save_page_api.cc @@ -124,7 +124,7 @@ void SavePageAsMHTMLFunction::ReturnFailure(const std::string& error) { void SavePageAsMHTMLFunction::ReturnSuccess(int64 file_size) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - int child_id = render_view_host()->process()->id(); + int child_id = render_view_host()->process()->GetID(); ChildProcessSecurityPolicy::GetInstance()->GrantReadFile( child_id, mhtml_path_); diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 3f77711..9f55624 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -87,12 +87,12 @@ #include "content/browser/debugger/devtools_manager.h" #include "content/browser/plugin_process_host.h" #include "content/browser/plugin_service.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/browser/user_metrics.h" #include "content/common/pepper_plugin_registry.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/render_process_host.h" #include "googleurl/src/gurl.h" #include "net/base/registry_controlled_domain.h" #include "webkit/database/database_tracker.h" @@ -916,11 +916,12 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { content::Details<const Extension>(extension)); // Tell renderers about the new extension. - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* host = i.GetCurrentValue(); + content::RenderProcessHost* host = i.GetCurrentValue(); Profile* host_profile = - Profile::FromBrowserContext(host->browser_context()); + Profile::FromBrowserContext(host->GetBrowserContext()); if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) { std::vector<ExtensionMsg_Loaded_Params> loaded_extensions( 1, ExtensionMsg_Loaded_Params(extension)); @@ -1036,11 +1037,12 @@ void ExtensionService::NotifyExtensionUnloaded( content::Source<Profile>(profile_), content::Details<UnloadedExtensionInfo>(&details)); - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { - RenderProcessHost* host = i.GetCurrentValue(); + content::RenderProcessHost* host = i.GetCurrentValue(); Profile* host_profile = - Profile::FromBrowserContext(host->browser_context()); + Profile::FromBrowserContext(host->GetBrowserContext()); if (host_profile->GetOriginalProfile() == profile_->GetOriginalProfile()) host->Send(new ExtensionMsg_Unloaded(extension->id())); } @@ -2316,10 +2318,10 @@ void ExtensionService::Observe(int type, break; } case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* host_profile = - Profile::FromBrowserContext(process->browser_context()); + Profile::FromBrowserContext(process->GetBrowserContext()); if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) break; @@ -2343,21 +2345,21 @@ void ExtensionService::Observe(int type, break; } case content::NOTIFICATION_RENDERER_PROCESS_TERMINATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* host_profile = - Profile::FromBrowserContext(process->browser_context()); + Profile::FromBrowserContext(process->GetBrowserContext()); if (!profile_->IsSameProfile(host_profile->GetOriginalProfile())) break; - installed_app_hosts_.erase(process->id()); + installed_app_hosts_.erase(process->GetID()); - process_map_.Remove(process->id()); + process_map_.Remove(process->GetID()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&ExtensionInfoMap::UnregisterAllExtensionsInProcess, profile_->GetExtensionInfoMap(), - process->id())); + process->GetID())); break; } case chrome::NOTIFICATION_PREF_CHANGED: { diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc index 7ad5261..3456a53 100644 --- a/chrome/browser/extensions/extension_tab_helper.cc +++ b/chrome/browser/extensions/extension_tab_helper.cc @@ -169,7 +169,7 @@ void ExtensionTabHelper::OnGetAppNotifyChannel( Profile::FromBrowserContext(tab_contents()->browser_context()); ExtensionService* extension_service = profile->GetExtensionService(); extensions::ProcessMap* process_map = extension_service->process_map(); - RenderProcessHost* process = + content::RenderProcessHost* process = tab_contents_wrapper()->render_view_host()->process(); const Extension* extension = extension_service->GetInstalledApp(requestor_url); @@ -177,7 +177,7 @@ void ExtensionTabHelper::OnGetAppNotifyChannel( extension && extension->HasAPIPermission( ExtensionAPIPermission::kExperimental) && - process_map->Contains(extension->id(), process->id()); + process_map->Contains(extension->id(), process->GetID()); if (!allowed) { AppNotifyChannelSetupComplete("", "permission_error", return_route_id, callback_id); diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc index bf51e24..581e8e4 100644 --- a/chrome/browser/extensions/extension_tab_id_map.cc +++ b/chrome/browser/extensions/extension_tab_id_map.cc @@ -74,7 +74,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id(), + host->process()->GetID(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); break; @@ -88,7 +88,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id(), + host->process()->GetID(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); break; @@ -107,7 +107,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::SetTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id(), + host->process()->GetID(), host->routing_id(), tab->restore_tab_helper()->session_id().id(), tab->restore_tab_helper()->window_id().id())); break; @@ -119,7 +119,7 @@ void ExtensionTabIdMap::TabObserver::Observe( base::Bind( &ExtensionTabIdMap::ClearTabAndWindowId, base::Unretained(ExtensionTabIdMap::GetInstance()), - host->process()->id(), host->routing_id())); + host->process()->GetID(), host->routing_id())); break; } default: diff --git a/chrome/browser/extensions/extension_webrequest_api.cc b/chrome/browser/extensions/extension_webrequest_api.cc index 9a2c189..e6038ed 100644 --- a/chrome/browser/extensions/extension_webrequest_api.cc +++ b/chrome/browser/extensions/extension_webrequest_api.cc @@ -290,10 +290,11 @@ void NotifyWebRequestAPIUsed(void* profile_id, const Extension* extension) { profile->GetExtensionService()->SetHasUsedWebRequest(extension, true); content::BrowserContext* browser_context = profile; - for (RenderProcessHost::iterator it = RenderProcessHost::AllHostsIterator(); + for (content::RenderProcessHost::iterator it = + content::RenderProcessHost::AllHostsIterator(); !it.IsAtEnd(); it.Advance()) { - RenderProcessHost* host = it.GetCurrentValue(); - if (host->browser_context() == browser_context) + content::RenderProcessHost* host = it.GetCurrentValue(); + if (host->GetBrowserContext() == browser_context) SendExtensionWebRequestStatusToHost(host); } } @@ -1629,8 +1630,8 @@ void WebRequestHandlerBehaviorChanged::OnQuotaExceeded() { Run(); } -void SendExtensionWebRequestStatusToHost(RenderProcessHost* host) { - Profile* profile = Profile::FromBrowserContext(host->browser_context()); +void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); if (!profile || !profile->GetExtensionService()) return; diff --git a/chrome/browser/extensions/extension_webrequest_api.h b/chrome/browser/extensions/extension_webrequest_api.h index 8e28f41..400d46a 100644 --- a/chrome/browser/extensions/extension_webrequest_api.h +++ b/chrome/browser/extensions/extension_webrequest_api.h @@ -26,13 +26,16 @@ class ExtensionInfoMap; class ExtensionWebRequestTimeTracker; class GURL; -class RenderProcessHost; namespace base { class DictionaryValue; class ListValue; } +namespace content { +class RenderProcessHost; +} + namespace net { class AuthCredentials; class AuthChallengeInfo; @@ -366,6 +369,6 @@ class WebRequestHandlerBehaviorChanged : public SyncIOThreadExtensionFunction { // Send updates to |host| with information about what webRequest-related // extensions are installed. // TODO(mpcomplete): remove. http://crbug.com/100411 -void SendExtensionWebRequestStatusToHost(RenderProcessHost* host); +void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host); #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEBREQUEST_API_H_ diff --git a/chrome/browser/extensions/isolated_app_browsertest.cc b/chrome/browser/extensions/isolated_app_browsertest.cc index 541a0ce..431aa7a 100644 --- a/chrome/browser/extensions/isolated_app_browsertest.cc +++ b/chrome/browser/extensions/isolated_app_browsertest.cc @@ -12,10 +12,10 @@ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" -#include "content/browser/renderer_host/browser_render_process_host.h" #include "content/browser/renderer_host/render_view_host.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/common/test_url_constants.h" +#include "content/public/browser/render_process_host.h" #include "net/base/mock_host_resolver.h" namespace { @@ -37,7 +37,7 @@ class IsolatedAppTest : public ExtensionBrowserTest { ExtensionService* service = profile->GetExtensionService(); if (service) { installed_app = service->GetInstalledAppForRenderer( - contents->render_view_host()->process()->id()); + contents->render_view_host()->process()->GetID()); } return installed_app; } @@ -169,7 +169,7 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, NoCookieIsolationWithoutApp) { // RenderProcessHosts even if we hit the process limit. IN_PROC_BROWSER_TEST_F(IsolatedAppTest, ProcessOverflow) { // Set max renderers to 1 to force running out of processes. - RenderProcessHost::SetMaxRendererProcessCountForTest(1); + content::RenderProcessHost::SetMaxRendererProcessCountForTest(1); host_resolver()->AddRule("*", "127.0.0.1"); ASSERT_TRUE(test_server()->Start()); @@ -205,15 +205,15 @@ IN_PROC_BROWSER_TEST_F(IsolatedAppTest, ProcessOverflow) { NEW_FOREGROUND_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); ASSERT_EQ(5, browser()->tab_count()); - RenderProcessHost* isolated1_host = + content::RenderProcessHost* isolated1_host = browser()->GetTabContentsAt(0)->GetRenderProcessHost(); - RenderProcessHost* ntp_host = + content::RenderProcessHost* ntp_host = browser()->GetTabContentsAt(1)->GetRenderProcessHost(); - RenderProcessHost* normal_extension_host = + content::RenderProcessHost* normal_extension_host = browser()->GetTabContentsAt(2)->GetRenderProcessHost(); - RenderProcessHost* web_host = + content::RenderProcessHost* web_host = browser()->GetTabContentsAt(3)->GetRenderProcessHost(); - RenderProcessHost* isolated2_host = + content::RenderProcessHost* isolated2_host = browser()->GetTabContentsAt(4)->GetRenderProcessHost(); // Isolated apps shared with each other, but no one else. They're clannish diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc index f936459..7a2082a 100644 --- a/chrome/browser/extensions/user_script_master.cc +++ b/chrome/browser/extensions/user_script_master.cc @@ -24,8 +24,8 @@ #include "chrome/common/extensions/extension_message_bundle.h" #include "chrome/common/extensions/extension_resource.h" #include "chrome/common/extensions/extension_set.h" -#include "content/browser/renderer_host/render_process_host.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/render_process_host.h" using content::BrowserThread; @@ -320,7 +320,8 @@ void UserScriptMaster::NewScriptsAvailable(base::SharedMemory* handle) { // We've got scripts ready to go. shared_memory_.swap(handle_deleter); - for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); + for (content::RenderProcessHost::iterator i( + content::RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { SendUpdate(i.GetCurrentValue(), handle); } @@ -380,10 +381,10 @@ void UserScriptMaster::Observe(int type, break; } case content::NOTIFICATION_RENDERER_PROCESS_CREATED: { - RenderProcessHost* process = - content::Source<RenderProcessHost>(source).ptr(); + content::RenderProcessHost* process = + content::Source<content::RenderProcessHost>(source).ptr(); Profile* profile = Profile::FromBrowserContext( - process->browser_context()); + process->GetBrowserContext()); if (!profile_->IsSameProfile(profile)) return; if (ScriptsReady()) @@ -410,9 +411,9 @@ void UserScriptMaster::StartLoad() { script_reloader_->StartLoad(user_scripts_, extensions_info_); } -void UserScriptMaster::SendUpdate(RenderProcessHost* process, +void UserScriptMaster::SendUpdate(content::RenderProcessHost* process, base::SharedMemory* shared_memory) { - Profile* profile = Profile::FromBrowserContext(process->browser_context()); + Profile* profile = Profile::FromBrowserContext(process->GetBrowserContext()); // Make sure we only send user scripts to processes in our profile. if (!profile_->IsSameProfile(profile)) return; diff --git a/chrome/browser/extensions/user_script_master.h b/chrome/browser/extensions/user_script_master.h index 291d932..2be6189 100644 --- a/chrome/browser/extensions/user_script_master.h +++ b/chrome/browser/extensions/user_script_master.h @@ -26,8 +26,11 @@ namespace base { class StringPiece; } -class Profile; +namespace content { class RenderProcessHost; +} + +class Profile; typedef std::map<std::string, ExtensionSet::ExtensionPathAndDefaultLocale> ExtensionsInfo; @@ -135,7 +138,7 @@ class UserScriptMaster : public base::RefCountedThreadSafe<UserScriptMaster>, const content::NotificationDetails& details) OVERRIDE; // Sends the renderer process a new set of user scripts. - void SendUpdate(RenderProcessHost* process, + void SendUpdate(content::RenderProcessHost* process, base::SharedMemory* shared_memory); // Manages our notification registrations. |