OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/tab_contents/tab_contents_view.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view.h" |
6 | 6 |
7 #include "chrome/browser/renderer_host/render_process_host.h" | 7 #include "chrome/browser/renderer_host/render_process_host.h" |
8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
9 #include "chrome/browser/renderer_host/render_widget_host.h" | 9 #include "chrome/browser/renderer_host/render_widget_host.h" |
10 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 10 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
11 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 11 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
12 #include "chrome/browser/tab_contents/tab_contents.h" | 12 #include "chrome/browser/tab_contents/tab_contents.h" |
13 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 13 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
| 14 #include "chrome/common/notification_service.h" |
| 15 #include "chrome/common/render_messages_params.h" |
14 | 16 |
15 TabContentsView::TabContentsView(TabContents* tab_contents) | 17 TabContentsView::TabContentsView(TabContents* tab_contents) |
16 : tab_contents_(tab_contents) { | 18 : tab_contents_(tab_contents) { |
17 } | 19 } |
18 | 20 |
19 TabContentsView::~TabContentsView() {} | 21 TabContentsView::~TabContentsView() {} |
20 | 22 |
21 void TabContentsView::RenderWidgetHostDestroyed(RenderWidgetHost* host) { | 23 void TabContentsView::RenderWidgetHostDestroyed(RenderWidgetHost* host) { |
22 if (host->view()) | 24 if (host->view()) |
23 host->view()->WillDestroyRenderWidget(host); | 25 host->view()->WillDestroyRenderWidget(host); |
24 delegate_view_helper_.RenderWidgetHostDestroyed(host); | 26 delegate_view_helper_.RenderWidgetHostDestroyed(host); |
25 } | 27 } |
26 | 28 |
27 void TabContentsView::RenderViewCreated(RenderViewHost* host) { | 29 void TabContentsView::RenderViewCreated(RenderViewHost* host) { |
28 // Default implementation does nothing. Platforms may override. | 30 // Default implementation does nothing. Platforms may override. |
29 } | 31 } |
30 | 32 |
31 void TabContentsView::CreateNewWindow( | 33 void TabContentsView::CreateNewWindow( |
32 int route_id, | 34 int route_id, |
33 WindowContainerType window_container_type, | 35 const ViewHostMsg_CreateWindow_Params& params) { |
34 const string16& frame_name) { | |
35 TabContents* new_contents = delegate_view_helper_.CreateNewWindow( | 36 TabContents* new_contents = delegate_view_helper_.CreateNewWindow( |
36 route_id, | 37 route_id, |
37 tab_contents_->profile(), | 38 tab_contents_->profile(), |
38 tab_contents_->GetSiteInstance(), | 39 tab_contents_->GetSiteInstance(), |
39 DOMUIFactory::GetDOMUIType(tab_contents_->profile(), | 40 DOMUIFactory::GetDOMUIType(tab_contents_->profile(), |
40 tab_contents_->GetURL()), | 41 tab_contents_->GetURL()), |
41 tab_contents_, | 42 tab_contents_, |
42 window_container_type, | 43 params.window_container_type, |
43 frame_name); | 44 params.frame_name); |
44 | 45 |
45 if (new_contents && tab_contents_->delegate()) | 46 if (new_contents) { |
46 tab_contents_->delegate()->TabContentsCreated(new_contents); | 47 NotificationService::current()->Notify( |
| 48 NotificationType::CREATING_NEW_WINDOW, |
| 49 Source<TabContents>(tab_contents_), |
| 50 Details<const ViewHostMsg_CreateWindow_Params>(¶ms)); |
| 51 |
| 52 if (tab_contents_->delegate()) |
| 53 tab_contents_->delegate()->TabContentsCreated(new_contents); |
| 54 } |
47 } | 55 } |
48 | 56 |
49 void TabContentsView::CreateNewWidget(int route_id, | 57 void TabContentsView::CreateNewWidget(int route_id, |
50 WebKit::WebPopupType popup_type) { | 58 WebKit::WebPopupType popup_type) { |
51 CreateNewWidgetInternal(route_id, popup_type); | 59 CreateNewWidgetInternal(route_id, popup_type); |
52 } | 60 } |
53 | 61 |
54 void TabContentsView::CreateNewFullscreenWidget( | 62 void TabContentsView::CreateNewFullscreenWidget( |
55 int route_id, WebKit::WebPopupType popup_type) { | 63 int route_id, WebKit::WebPopupType popup_type) { |
56 CreateNewFullscreenWidgetInternal(route_id, popup_type); | 64 CreateNewFullscreenWidgetInternal(route_id, popup_type); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 161 } |
154 | 162 |
155 void TabContentsView::ShowCreatedFullscreenWidgetInternal( | 163 void TabContentsView::ShowCreatedFullscreenWidgetInternal( |
156 RenderWidgetHostView* widget_host_view) { | 164 RenderWidgetHostView* widget_host_view) { |
157 if (tab_contents_->delegate()) | 165 if (tab_contents_->delegate()) |
158 tab_contents_->delegate()->RenderWidgetShowing(); | 166 tab_contents_->delegate()->RenderWidgetShowing(); |
159 | 167 |
160 widget_host_view->InitAsFullscreen(tab_contents_->GetRenderWidgetHostView()); | 168 widget_host_view->InitAsFullscreen(tab_contents_->GetRenderWidgetHostView()); |
161 widget_host_view->GetRenderWidgetHost()->Init(); | 169 widget_host_view->GetRenderWidgetHost()->Init(); |
162 } | 170 } |
OLD | NEW |