summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/DEPS1
-rw-r--r--chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc4
-rw-r--r--chrome/browser/prerender/prerender_manager.cc1
-rw-r--r--chrome/browser/tab_contents/thumbnail_generator_unittest.cc1
-rw-r--r--chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm12
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_container.cc12
-rw-r--r--chrome/browser/ui/webui/web_ui_unittest.cc8
-rw-r--r--chrome/test/base/browser_with_test_window_test.cc6
-rw-r--r--chrome/test/perf/rendering/latency_tests.cc3
-rw-r--r--content/browser/renderer_host/render_view_host_manager_browsertest.cc6
-rw-r--r--content/browser/renderer_host/test_render_view_host.cc8
-rw-r--r--content/browser/renderer_host/test_render_view_host.h4
-rw-r--r--content/browser/tab_contents/render_view_host_manager.cc18
-rw-r--r--content/browser/tab_contents/render_view_host_manager.h7
-rw-r--r--content/browser/tab_contents/tab_contents.cc8
-rw-r--r--content/browser/tab_contents/tab_contents.h4
-rw-r--r--content/public/browser/notification_types.h4
-rw-r--r--content/public/browser/web_contents.h4
18 files changed, 59 insertions, 52 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index 0f3e00f..add6ec0 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -36,6 +36,7 @@ include_rules = [
"-content/browser/notification_service_impl.h",
"-content/browser/tab_contents/navigation_controller_impl.h",
"-content/browser/tab_contents/navigation_entry_impl.h",
+ "-content/browser/tab_contents/render_view_host_manager.h",
"-content/browser/plugin_service_impl.h",
"-content/browser/worker_service_impl.h",
diff --git a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
index 86a25dc..7380d46 100644
--- a/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/chrome_geolocation_permission_context_unittest.cc
@@ -212,8 +212,8 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) {
WebContents::Create(profile(), NULL, MSG_ROUTING_NONE, NULL, NULL);
new_tab->GetController().LoadURL(
url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
- static_cast<TestRenderViewHost*>(new_tab->GetRenderManagerForTesting()->
- current_host())->SendNavigate(extra_tabs_.size() + 1, url);
+ static_cast<TestRenderViewHost*>(new_tab->GetRenderViewHost())->
+ SendNavigate(extra_tabs_.size() + 1, url);
extra_tabs_.push_back(new TabContentsWrapper(new_tab));
}
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index ecf5eb0..b5193ea 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -39,7 +39,6 @@
#include "content/browser/in_process_webkit/session_storage_namespace.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
-#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host_registry.h"
#include "content/public/browser/navigation_controller.h"
diff --git a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
index 9c23f25..fc2ac3d 100644
--- a/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator_unittest.cc
@@ -12,7 +12,6 @@
#include "content/browser/renderer_host/backing_store_skia.h"
#include "content/browser/renderer_host/mock_render_process_host.h"
#include "content/browser/renderer_host/test_render_view_host.h"
-#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/common/view_messages.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
diff --git a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
index abb4401..480eae3 100644
--- a/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.mm
@@ -4,10 +4,11 @@
#import "chrome/browser/ui/cocoa/tab_contents/tab_contents_controller.h"
+#include <utility>
+
#include "base/memory/scoped_nsobject.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
-#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -55,10 +56,11 @@ void TabContentsNotificationBridge::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
- RenderViewHostSwitchedDetails* switched_details =
- content::Details<RenderViewHostSwitchedDetails>(details).ptr();
- [controller_ tabContentsRenderViewHostChanged:switched_details->old_host
- newHost:switched_details->new_host];
+ std::pair<RenderViewHost*, RenderViewHost*>* switched_details =
+ content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(
+ details).ptr();
+ [controller_ tabContentsRenderViewHostChanged:switched_details->first
+ newHost:switched_details->second];
} else {
NOTREACHED();
}
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
index be7e5de1..2e70052 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_container.cc
@@ -4,10 +4,11 @@
#include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
+#include <utility>
+
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/public/browser/notification_details.h"
@@ -78,10 +79,11 @@ void TabContentsContainer::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
- RenderViewHostSwitchedDetails* switched_details =
- content::Details<RenderViewHostSwitchedDetails>(details).ptr();
- RenderViewHostChanged(switched_details->old_host,
- switched_details->new_host);
+ std::pair<RenderViewHost*, RenderViewHost*>* switched_details =
+ content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(
+ details).ptr();
+ RenderViewHostChanged(switched_details->first,
+ switched_details->second);
} else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) {
TabContentsDestroyed(content::Source<WebContents>(source).ptr());
} else {
diff --git a/chrome/browser/ui/webui/web_ui_unittest.cc b/chrome/browser/ui/webui/web_ui_unittest.cc
index ef7094e..fc9bbc8 100644
--- a/chrome/browser/ui/webui/web_ui_unittest.cc
+++ b/chrome/browser/ui/webui/web_ui_unittest.cc
@@ -68,10 +68,10 @@ class WebUITest : public TabContentsWrapperTestHarness {
// process transition, and our RVH pointer will be the "committed" one.
// In the second call to this function from WebUIToStandard, it won't
// actually be pending, which is the point of this test.
- if (contents->GetRenderManagerForTesting()->pending_render_view_host()) {
- static_cast<TestRenderViewHost*>(
- contents->GetRenderManagerForTesting()->
- pending_render_view_host())->SendNavigate(page_id + 1, next_url);
+ TestRenderViewHost* pending_rvh =
+ TestRenderViewHost::GetPendingForController(controller);
+ if (pending_rvh) {
+ pending_rvh->SendNavigate(page_id + 1, next_url);
} else {
static_cast<TestRenderViewHost*>(
contents->GetRenderViewHost())->SendNavigate(page_id + 1, next_url);
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc
index 79ef96d..2106b4d 100644
--- a/chrome/test/base/browser_with_test_window_test.cc
+++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/render_messages.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
@@ -80,9 +79,8 @@ void BrowserWithTestWindowTest::CommitPendingLoad(
TestRenderViewHost* old_rvh =
TestRenderViewHostForTab(controller->GetWebContents());
- TestRenderViewHost* pending_rvh = static_cast<TestRenderViewHost*>(
- controller->GetWebContents()->GetRenderManagerForTesting()->
- pending_render_view_host());
+ TestRenderViewHost* pending_rvh = TestRenderViewHost::GetPendingForController(
+ controller);
if (pending_rvh) {
// Simulate the ShouldClose_ACK that is received from the current renderer
// for a cross-site navigation.
diff --git a/chrome/test/perf/rendering/latency_tests.cc b/chrome/test/perf/rendering/latency_tests.cc
index fbd261c..63dba6c 100644
--- a/chrome/test/perf/rendering/latency_tests.cc
+++ b/chrome/test/perf/rendering/latency_tests.cc
@@ -22,7 +22,6 @@
#include "chrome/test/perf/browser_perf_test.h"
#include "chrome/test/perf/perf_test.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
@@ -541,7 +540,7 @@ void LatencyTest::GetMeanFrameTimeMicros(int* frame_time) const {
void LatencyTest::SendInput() {
RenderViewHost* rvh = browser()->GetSelectedTabContentsWrapper()->
- web_contents()->GetRenderManagerForTesting()->current_host();
+ web_contents()->GetRenderViewHost();
WebKit::WebMouseEvent mouse_event;
mouse_event.movementX = 1;
mouse_x_ += mouse_event.movementX;
diff --git a/content/browser/renderer_host/render_view_host_manager_browsertest.cc b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
index e14db12..5565ece 100644
--- a/content/browser/renderer_host/render_view_host_manager_browsertest.cc
+++ b/content/browser/renderer_host/render_view_host_manager_browsertest.cc
@@ -83,8 +83,10 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest,
// Wait for the cross-site transition in the new tab to finish.
ui_test_utils::WaitForLoadStop(browser()->GetSelectedWebContents());
- EXPECT_FALSE(browser()->GetSelectedWebContents()->
- GetRenderManagerForTesting()->pending_render_view_host());
+ TabContents* tab_contents = static_cast<TabContents*>(
+ browser()->GetSelectedWebContents());
+ EXPECT_FALSE(tab_contents->GetRenderManagerForTesting()->
+ pending_render_view_host());
// Should have a new SiteInstance.
scoped_refptr<SiteInstance> noref_blank_site_instance(
diff --git a/content/browser/renderer_host/test_render_view_host.cc b/content/browser/renderer_host/test_render_view_host.cc
index 411dd3a..2eb189e 100644
--- a/content/browser/renderer_host/test_render_view_host.cc
+++ b/content/browser/renderer_host/test_render_view_host.cc
@@ -58,6 +58,14 @@ void SimulateUpdateRect(RenderWidgetHost* widget,
widget->OnMessageReceived(msg);
}
+TestRenderViewHost* TestRenderViewHost::GetPendingForController(
+ content::NavigationController* controller) {
+ TabContents* tab_contents = static_cast<TabContents*>(
+ controller->GetWebContents());
+ return static_cast<TestRenderViewHost*>(
+ tab_contents->GetRenderManagerForTesting()->pending_render_view_host());
+}
+
TestRenderViewHost::TestRenderViewHost(SiteInstance* instance,
RenderViewHostDelegate* delegate,
int routing_id)
diff --git a/content/browser/renderer_host/test_render_view_host.h b/content/browser/renderer_host/test_render_view_host.h
index 5953308..4d0ab9a 100644
--- a/content/browser/renderer_host/test_render_view_host.h
+++ b/content/browser/renderer_host/test_render_view_host.h
@@ -169,6 +169,10 @@ class TestRenderWidgetHostView : public RenderWidgetHostView {
// CreateRenderViewForRenderManager when more complicate tests start using this.
class TestRenderViewHost : public RenderViewHost {
public:
+ // If the given TabContnets has a pending RVH, returns it, otherwise NULL.
+ static TestRenderViewHost* GetPendingForController(
+ content::NavigationController* controller);
+
TestRenderViewHost(SiteInstance* instance,
RenderViewHostDelegate* delegate,
int routing_id);
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index 7740608..3ac77f61 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -4,6 +4,8 @@
#include "content/browser/tab_contents/render_view_host_manager.h"
+#include <utility>
+
#include "base/command_line.h"
#include "base/logging.h"
#include "content/browser/debugger/devtools_manager_impl.h"
@@ -111,14 +113,15 @@ RenderViewHost* RenderViewHostManager::Navigate(
} else {
// This is our primary renderer, notify here as we won't be calling
// CommitPending (which does the notify).
- RenderViewHostSwitchedDetails details;
- details.new_host = render_view_host_;
- details.old_host = NULL;
+ RenderViewHost* null_rvh = NULL;
+ std::pair<RenderViewHost*, RenderViewHost*> details =
+ std::make_pair(null_rvh, render_view_host_);
content::NotificationService::current()->Notify(
content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
content::Source<NavigationController>(
&delegate_->GetControllerForRenderManager()),
- content::Details<RenderViewHostSwitchedDetails>(&details));
+ content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(
+ &details));
}
}
@@ -600,14 +603,13 @@ void RenderViewHostManager::CommitPending() {
else if (focus_render_view && render_view_host_->view())
render_view_host_->view()->Focus();
- RenderViewHostSwitchedDetails details;
- details.new_host = render_view_host_;
- details.old_host = old_render_view_host;
+ std::pair<RenderViewHost*, RenderViewHost*> details =
+ std::make_pair(old_render_view_host, render_view_host_);
content::NotificationService::current()->Notify(
content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
content::Source<NavigationController>(
&delegate_->GetControllerForRenderManager()),
- content::Details<RenderViewHostSwitchedDetails>(&details));
+ content::Details<std::pair<RenderViewHost*, RenderViewHost*> >(&details));
// If the pending view was on the swapped out list, we can remove it.
swapped_out_hosts_.erase(render_view_host_->site_instance()->id());
diff --git a/content/browser/tab_contents/render_view_host_manager.h b/content/browser/tab_contents/render_view_host_manager.h
index 73c2fca..a8d0a90 100644
--- a/content/browser/tab_contents/render_view_host_manager.h
+++ b/content/browser/tab_contents/render_view_host_manager.h
@@ -292,11 +292,4 @@ class CONTENT_EXPORT RenderViewHostManager
DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager);
};
-// The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old
-// host can be NULL when the first RenderViewHost is set.
-struct RenderViewHostSwitchedDetails {
- RenderViewHost* old_host;
- RenderViewHost* new_host;
-};
-
#endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 65e0e4f..b2aec15 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -297,6 +297,10 @@ NavigationControllerImpl& TabContents::GetControllerImpl() {
return controller_;
}
+RenderViewHostManager* TabContents::GetRenderManagerForTesting() {
+ return &render_manager_;
+}
+
bool TabContents::OnMessageReceived(const IPC::Message& message) {
if (GetWebUI() && GetWebUI()->OnMessageReceived(message))
return true;
@@ -635,10 +639,6 @@ bool TabContents::NeedToFireBeforeUnload() {
!GetRenderViewHost()->SuddenTerminationAllowed();
}
-RenderViewHostManager* TabContents::GetRenderManagerForTesting() {
- return &render_manager_;
-}
-
void TabContents::Stop() {
render_manager_.Stop();
FOR_EACH_OBSERVER(WebContentsObserver, observers_, StopNavigation());
diff --git a/content/browser/tab_contents/tab_contents.h b/content/browser/tab_contents/tab_contents.h
index 12bad9d..6585c7a 100644
--- a/content/browser/tab_contents/tab_contents.h
+++ b/content/browser/tab_contents/tab_contents.h
@@ -115,6 +115,9 @@ class CONTENT_EXPORT TabContents
// Like GetController from WebContents, but returns the concrete object.
NavigationControllerImpl& GetControllerImpl();
+ // Expose the render manager for testing.
+ RenderViewHostManager* GetRenderManagerForTesting();
+
// content::WebContents ------------------------------------------------------
virtual const base::PropertyBag* GetPropertyBag() const OVERRIDE;
virtual base::PropertyBag* GetPropertyBag() OVERRIDE;
@@ -158,7 +161,6 @@ class CONTENT_EXPORT TabContents
virtual void ShowContents() OVERRIDE;
virtual void HideContents() OVERRIDE;
virtual bool NeedToFireBeforeUnload() OVERRIDE;
- virtual RenderViewHostManager* GetRenderManagerForTesting() OVERRIDE;
virtual void Stop() OVERRIDE;
virtual content::WebContents* Clone() OVERRIDE;
virtual void ShowPageInfo(const GURL& url,
diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h
index c3f1381..363df21 100644
--- a/content/public/browser/notification_types.h
+++ b/content/public/browser/notification_types.h
@@ -291,8 +291,8 @@ enum NotificationType {
// This is sent to notify that the RenderViewHost displayed in a
// TabContents has changed. Source is the NavigationController for which the
- // change happened, details is the previous RenderViewHost (can be NULL when
- // the first RenderViewHost is set).
+ // change happened, details is a
+ // std::pair::<old RenderViewHost, new RenderViewHost>).
NOTIFICATION_RENDER_VIEW_HOST_CHANGED,
// Indicates that the render view host has received an accessibility tree
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 69afc41..bcfe84f 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -19,7 +19,6 @@
class InterstitialPage;
class RenderViewHost;
-class RenderViewHostManager;
class RenderWidgetHostView;
class SessionStorageNamespace;
class SiteInstance;
@@ -201,9 +200,6 @@ class WebContents : public PageNavigator {
// returns false.
virtual bool NeedToFireBeforeUnload() = 0;
- // Expose the render manager for testing.
- virtual RenderViewHostManager* GetRenderManagerForTesting() = 0;
-
// Commands ------------------------------------------------------------------
// Stop any pending navigation.