Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2372)

Unified Diff: content/public/renderer/render_view_observer.cc

Issue 302553007: Call RenderViewImpl::SetScreenOrientationForTesting to make sure that events are not sent when orie… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now ResetMockScreenOrientationForTesting() is called on every layout test finish, so replaced DCHEC… Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/renderer/render_view_observer.cc
diff --git a/content/public/renderer/render_view_observer.cc b/content/public/renderer/render_view_observer.cc
index 612fb150234d6ce79d81ab207e9eb65b4f199807..8289da949e1311a2769928a660a532edc75c5b44 100644
--- a/content/public/renderer/render_view_observer.cc
+++ b/content/public/renderer/render_view_observer.cc
@@ -13,7 +13,7 @@ namespace content {
RenderViewObserver::RenderViewObserver(RenderView* render_view)
: render_view_(render_view),
routing_id_(MSG_ROUTING_NONE) {
- // |render_view| can be NULL on unit testing.
+ // |render_view| can be NULL on unit testing or if Observe() is used.
if (render_view) {
RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view);
routing_id_ = impl->routing_id();
@@ -53,4 +53,19 @@ void RenderViewObserver::RenderViewGone() {
render_view_ = NULL;
}
+void RenderViewObserver::Observe(RenderView* render_view) {
+ RenderViewImpl* impl = static_cast<RenderViewImpl*>(render_view_);
+ if (impl) {
+ impl->RemoveObserver(this);
+ routing_id_ = 0;
+ }
+
+ render_view_ = render_view;
+ impl = static_cast<RenderViewImpl*>(render_view_);
+ if (impl) {
+ routing_id_ = impl->routing_id();
+ impl->AddObserver(this);
+ }
+}
+
} // namespace content
« no previous file with comments | « content/public/renderer/render_view_observer.h ('k') | content/renderer/renderer_webkitplatformsupport_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698