OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 } | 1238 } |
1239 | 1239 |
1240 TabContents* TabContents::GetAsTabContents() { | 1240 TabContents* TabContents::GetAsTabContents() { |
1241 return this; | 1241 return this; |
1242 } | 1242 } |
1243 | 1243 |
1244 ViewType::Type TabContents::GetRenderViewType() const { | 1244 ViewType::Type TabContents::GetRenderViewType() const { |
1245 return ViewType::TAB_CONTENTS; | 1245 return ViewType::TAB_CONTENTS; |
1246 } | 1246 } |
1247 | 1247 |
1248 int TabContents::GetBrowserWindowID() const { | |
1249 return controller().window_id().id(); | |
1250 } | |
1251 | |
1252 void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { | 1248 void TabContents::RenderViewCreated(RenderViewHost* render_view_host) { |
1253 NotificationService::current()->Notify( | 1249 NotificationService::current()->Notify( |
1254 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, | 1250 NotificationType::RENDER_VIEW_HOST_CREATED_FOR_TAB, |
1255 Source<TabContents>(this), | 1251 Source<TabContents>(this), |
1256 Details<RenderViewHost>(render_view_host)); | 1252 Details<RenderViewHost>(render_view_host)); |
1257 NavigationEntry* entry = controller_.GetActiveEntry(); | 1253 NavigationEntry* entry = controller_.GetActiveEntry(); |
1258 if (!entry) | 1254 if (!entry) |
1259 return; | 1255 return; |
1260 | 1256 |
1261 // When we're creating views, we're still doing initial setup, so we always | 1257 // When we're creating views, we're still doing initial setup, so we always |
1262 // use the pending Web UI rather than any possibly existing committed one. | 1258 // use the pending Web UI rather than any possibly existing committed one. |
1263 if (render_manager_.pending_web_ui()) | 1259 if (render_manager_.pending_web_ui()) |
1264 render_manager_.pending_web_ui()->RenderViewCreated(render_view_host); | 1260 render_manager_.pending_web_ui()->RenderViewCreated(render_view_host); |
1265 | 1261 |
1266 if (entry->IsViewSourceMode()) { | 1262 if (entry->IsViewSourceMode()) { |
1267 // Put the renderer in view source mode. | 1263 // Put the renderer in view source mode. |
1268 render_view_host->Send( | 1264 render_view_host->Send( |
1269 new ViewMsg_EnableViewSourceMode(render_view_host->routing_id())); | 1265 new ViewMsg_EnableViewSourceMode(render_view_host->routing_id())); |
1270 } | 1266 } |
1271 | 1267 |
1272 view()->RenderViewCreated(render_view_host); | 1268 view()->RenderViewCreated(render_view_host); |
1273 | 1269 |
1274 FOR_EACH_OBSERVER( | 1270 FOR_EACH_OBSERVER( |
1275 TabContentsObserver, observers_, RenderViewCreated(render_view_host)); | 1271 TabContentsObserver, observers_, RenderViewCreated(render_view_host)); |
| 1272 |
| 1273 if (delegate()) |
| 1274 delegate()->RenderViewCreated(this, render_view_host); |
1276 } | 1275 } |
1277 | 1276 |
1278 void TabContents::RenderViewReady(RenderViewHost* rvh) { | 1277 void TabContents::RenderViewReady(RenderViewHost* rvh) { |
1279 if (rvh != render_view_host()) { | 1278 if (rvh != render_view_host()) { |
1280 // Don't notify the world, since this came from a renderer in the | 1279 // Don't notify the world, since this came from a renderer in the |
1281 // background. | 1280 // background. |
1282 return; | 1281 return; |
1283 } | 1282 } |
1284 | 1283 |
1285 NotifyConnected(); | 1284 NotifyConnected(); |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 | 1838 |
1840 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 1839 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
1841 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 1840 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
1842 rwh_view->SetSize(view()->GetContainerSize()); | 1841 rwh_view->SetSize(view()->GetContainerSize()); |
1843 } | 1842 } |
1844 | 1843 |
1845 void TabContents::OnOnlineStateChanged(bool online) { | 1844 void TabContents::OnOnlineStateChanged(bool online) { |
1846 render_view_host()->Send(new ViewMsg_NetworkStateChanged( | 1845 render_view_host()->Send(new ViewMsg_NetworkStateChanged( |
1847 render_view_host()->routing_id(), online)); | 1846 render_view_host()->routing_id(), online)); |
1848 } | 1847 } |
OLD | NEW |