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

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

Issue 9347042: Introduce content::RenderWidgetHostViewPort (in content/port/browser). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 8 years, 10 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
« no previous file with comments | « content/browser/tab_contents/tab_contents_unittest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer_host/render_widget_host_view.h" 9 #include "content/browser/renderer_host/render_widget_host_view.h"
10 #include "content/browser/tab_contents/tab_contents.h" 10 #include "content/browser/tab_contents/tab_contents.h"
11 #include "content/common/view_messages.h" 11 #include "content/common/view_messages.h"
12 #include "content/public/browser/notification_service.h" 12 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_source.h" 13 #include "content/public/browser/notification_source.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_delegate.h" 16 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/public/browser/web_contents_view.h" 17 #include "content/public/browser/web_contents_view.h"
18 18
19 using content::RenderWidgetHostViewPort;
19 using content::WebContents; 20 using content::WebContents;
20 21
21 TabContentsViewHelper::TabContentsViewHelper() { 22 TabContentsViewHelper::TabContentsViewHelper() {
22 registrar_.Add(this, 23 registrar_.Add(this,
23 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 24 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
24 content::NotificationService::AllBrowserContextsAndSources()); 25 content::NotificationService::AllBrowserContextsAndSources());
25 } 26 }
26 27
27 TabContentsViewHelper::~TabContentsViewHelper() {} 28 TabContentsViewHelper::~TabContentsViewHelper() {}
28 29
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return new_contents; 86 return new_contents;
86 } 87 }
87 88
88 RenderWidgetHostView* TabContentsViewHelper::CreateNewWidget( 89 RenderWidgetHostView* TabContentsViewHelper::CreateNewWidget(
89 WebContents* web_contents, 90 WebContents* web_contents,
90 int route_id, 91 int route_id,
91 bool is_fullscreen, 92 bool is_fullscreen,
92 WebKit::WebPopupType popup_type) { 93 WebKit::WebPopupType popup_type) {
93 content::RenderProcessHost* process = web_contents->GetRenderProcessHost(); 94 content::RenderProcessHost* process = web_contents->GetRenderProcessHost();
94 RenderWidgetHost* widget_host = new RenderWidgetHost(process, route_id); 95 RenderWidgetHost* widget_host = new RenderWidgetHost(process, route_id);
95 RenderWidgetHostViewBase* widget_view = 96 RenderWidgetHostViewPort* widget_view =
96 RenderWidgetHostViewBase::CreateViewForWidget(widget_host); 97 RenderWidgetHostViewPort::CreateViewForWidget(widget_host);
97 if (!is_fullscreen) { 98 if (!is_fullscreen) {
98 // Popups should not get activated. 99 // Popups should not get activated.
99 widget_view->set_popup_type(popup_type); 100 widget_view->SetPopupType(popup_type);
100 } 101 }
101 // Save the created widget associated with the route so we can show it later. 102 // Save the created widget associated with the route so we can show it later.
102 pending_widget_views_[route_id] = widget_view; 103 pending_widget_views_[route_id] = widget_view;
103 return widget_view; 104 return widget_view;
104 } 105 }
105 106
106 TabContents* TabContentsViewHelper::GetCreatedWindow(int route_id) { 107 TabContents* TabContentsViewHelper::GetCreatedWindow(int route_id) {
107 PendingContents::iterator iter = pending_contents_.find(route_id); 108 PendingContents::iterator iter = pending_contents_.find(route_id);
108 109
109 // Certain systems can block the creation of new windows. If we didn't succeed 110 // Certain systems can block the creation of new windows. If we didn't succeed
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 161 }
161 162
162 RenderWidgetHostView* TabContentsViewHelper::ShowCreatedWidget( 163 RenderWidgetHostView* TabContentsViewHelper::ShowCreatedWidget(
163 WebContents* web_contents, 164 WebContents* web_contents,
164 int route_id, 165 int route_id,
165 bool is_fullscreen, 166 bool is_fullscreen,
166 const gfx::Rect& initial_pos) { 167 const gfx::Rect& initial_pos) {
167 if (web_contents->GetDelegate()) 168 if (web_contents->GetDelegate())
168 web_contents->GetDelegate()->RenderWidgetShowing(); 169 web_contents->GetDelegate()->RenderWidgetShowing();
169 170
170 RenderWidgetHostViewBase* widget_host_view = 171 RenderWidgetHostViewPort* widget_host_view =
171 RenderWidgetHostViewBase::FromRWHV(GetCreatedWidget(route_id)); 172 RenderWidgetHostViewPort::FromRWHV(GetCreatedWidget(route_id));
172 if (is_fullscreen) { 173 if (is_fullscreen) {
173 widget_host_view->InitAsFullscreen(web_contents->GetRenderWidgetHostView()); 174 widget_host_view->InitAsFullscreen(web_contents->GetRenderWidgetHostView());
174 } else { 175 } else {
175 widget_host_view->InitAsPopup(web_contents->GetRenderWidgetHostView(), 176 widget_host_view->InitAsPopup(web_contents->GetRenderWidgetHostView(),
176 initial_pos); 177 initial_pos);
177 } 178 }
178 widget_host_view->GetRenderWidgetHost()->Init(); 179 widget_host_view->GetRenderWidgetHost()->Init();
179 return widget_host_view; 180 return widget_host_view;
180 } 181 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents_unittest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698