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

Side by Side Diff: content/browser/tab_contents/tab_contents_view_helper.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/tab_contents/tab_contents_view_helper.h" 5 #include "content/browser/tab_contents/tab_contents_view_helper.h"
6 6
7 #include "content/browser/renderer_host/render_view_host.h" 7 #include "content/browser/renderer_host/render_view_host.h"
8 #include "content/browser/renderer_host/render_widget_host.h" 8 #include "content/browser/renderer_host/render_widget_host.h"
9 #include "content/browser/tab_contents/tab_contents.h" 9 #include "content/browser/tab_contents/tab_contents.h"
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 18 matching lines...) Expand all
29 TabContentsViewHelper::~TabContentsViewHelper() {} 29 TabContentsViewHelper::~TabContentsViewHelper() {}
30 30
31 void TabContentsViewHelper::Observe( 31 void TabContentsViewHelper::Observe(
32 int type, 32 int type,
33 const content::NotificationSource& source, 33 const content::NotificationSource& source,
34 const content::NotificationDetails& details) { 34 const content::NotificationDetails& details) {
35 DCHECK_EQ(type, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED); 35 DCHECK_EQ(type, content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED);
36 RenderWidgetHost* host = content::Source<RenderWidgetHost>(source).ptr(); 36 RenderWidgetHost* host = content::Source<RenderWidgetHost>(source).ptr();
37 for (PendingWidgetViews::iterator i = pending_widget_views_.begin(); 37 for (PendingWidgetViews::iterator i = pending_widget_views_.begin();
38 i != pending_widget_views_.end(); ++i) { 38 i != pending_widget_views_.end(); ++i) {
39 if (host->view() == i->second) { 39 if (host->GetView() == i->second) {
40 pending_widget_views_.erase(i); 40 pending_widget_views_.erase(i);
41 break; 41 break;
42 } 42 }
43 } 43 }
44 } 44 }
45 45
46 TabContents* TabContentsViewHelper::CreateNewWindow( 46 TabContents* TabContentsViewHelper::CreateNewWindow(
47 WebContents* web_contents, 47 WebContents* web_contents,
48 int route_id, 48 int route_id,
49 const ViewHostMsg_CreateWindow_Params& params) { 49 const ViewHostMsg_CreateWindow_Params& params) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // Certain systems can block the creation of new windows. If we didn't succeed 112 // Certain systems can block the creation of new windows. If we didn't succeed
113 // in creating one, just return NULL. 113 // in creating one, just return NULL.
114 if (iter == pending_contents_.end()) { 114 if (iter == pending_contents_.end()) {
115 return NULL; 115 return NULL;
116 } 116 }
117 117
118 TabContents* new_contents = iter->second; 118 TabContents* new_contents = iter->second;
119 pending_contents_.erase(route_id); 119 pending_contents_.erase(route_id);
120 120
121 if (!new_contents->GetRenderProcessHost()->HasConnection() || 121 if (!new_contents->GetRenderProcessHost()->HasConnection() ||
122 !new_contents->GetRenderViewHost()->view()) 122 !new_contents->GetRenderViewHost()->GetView())
123 return NULL; 123 return NULL;
124 124
125 // TODO(brettw): It seems bogus to reach into here and initialize the host. 125 // TODO(brettw): It seems bogus to reach into here and initialize the host.
126 new_contents->GetRenderViewHost()->Init(); 126 static_cast<RenderViewHostImpl*>(new_contents->GetRenderViewHost())->Init();
127 return new_contents; 127 return new_contents;
128 } 128 }
129 129
130 RenderWidgetHostView* TabContentsViewHelper::GetCreatedWidget(int route_id) { 130 RenderWidgetHostView* TabContentsViewHelper::GetCreatedWidget(int route_id) {
131 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); 131 PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id);
132 if (iter == pending_widget_views_.end()) { 132 if (iter == pending_widget_views_.end()) {
133 DCHECK(false); 133 DCHECK(false);
134 return NULL; 134 return NULL;
135 } 135 }
136 136
137 RenderWidgetHostView* widget_host_view = iter->second; 137 RenderWidgetHostView* widget_host_view = iter->second;
138 pending_widget_views_.erase(route_id); 138 pending_widget_views_.erase(route_id);
139 139
140 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost(); 140 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost();
141 if (!widget_host->process()->HasConnection()) { 141 if (!widget_host->GetProcess()->HasConnection()) {
142 // The view has gone away or the renderer crashed. Nothing to do. 142 // The view has gone away or the renderer crashed. Nothing to do.
143 return NULL; 143 return NULL;
144 } 144 }
145 145
146 return widget_host_view; 146 return widget_host_view;
147 } 147 }
148 148
149 TabContents* TabContentsViewHelper::ShowCreatedWindow( 149 TabContents* TabContentsViewHelper::ShowCreatedWindow(
150 WebContents* web_contents, 150 WebContents* web_contents,
151 int route_id, 151 int route_id,
(...skipping 19 matching lines...) Expand all
171 web_contents->GetDelegate()->RenderWidgetShowing(); 171 web_contents->GetDelegate()->RenderWidgetShowing();
172 172
173 RenderWidgetHostViewPort* widget_host_view = 173 RenderWidgetHostViewPort* widget_host_view =
174 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id)); 174 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id));
175 if (is_fullscreen) { 175 if (is_fullscreen) {
176 widget_host_view->InitAsFullscreen(web_contents->GetRenderWidgetHostView()); 176 widget_host_view->InitAsFullscreen(web_contents->GetRenderWidgetHostView());
177 } else { 177 } else {
178 widget_host_view->InitAsPopup(web_contents->GetRenderWidgetHostView(), 178 widget_host_view->InitAsPopup(web_contents->GetRenderWidgetHostView(),
179 initial_pos); 179 initial_pos);
180 } 180 }
181 RenderWidgetHostImpl::FromRWHV(widget_host_view)->Init(); 181 RenderWidgetHostImpl::From(widget_host_view->GetRenderWidgetHost())->Init();
182 return widget_host_view; 182 return widget_host_view;
183 } 183 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents_view_gtk.cc ('k') | content/browser/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698