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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) | 300 IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) |
301 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 301 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
302 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) | 302 IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
303 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 303 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
304 OnRegisterProtocolHandler) | 304 OnRegisterProtocolHandler) |
305 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterIntentHandler, | 305 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterIntentHandler, |
306 OnRegisterIntentHandler) | 306 OnRegisterIntentHandler) |
307 IPC_MESSAGE_HANDLER(ViewHostMsg_WebIntentDispatch, | 307 IPC_MESSAGE_HANDLER(ViewHostMsg_WebIntentDispatch, |
308 OnWebIntentDispatch) | 308 OnWebIntentDispatch) |
309 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 309 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
| 310 IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
310 IPC_MESSAGE_UNHANDLED(handled = false) | 311 IPC_MESSAGE_UNHANDLED(handled = false) |
311 IPC_END_MESSAGE_MAP_EX() | 312 IPC_END_MESSAGE_MAP_EX() |
312 | 313 |
313 if (!message_is_ok) { | 314 if (!message_is_ok) { |
314 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); | 315 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD")); |
315 GetRenderProcessHost()->ReceivedBadMessage(); | 316 GetRenderProcessHost()->ReceivedBadMessage(); |
316 } | 317 } |
317 | 318 |
318 return handled; | 319 return handled; |
319 } | 320 } |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 | 1140 |
1140 void TabContents::OnFindReply(int request_id, | 1141 void TabContents::OnFindReply(int request_id, |
1141 int number_of_matches, | 1142 int number_of_matches, |
1142 const gfx::Rect& selection_rect, | 1143 const gfx::Rect& selection_rect, |
1143 int active_match_ordinal, | 1144 int active_match_ordinal, |
1144 bool final_update) { | 1145 bool final_update) { |
1145 delegate()->FindReply(this, request_id, number_of_matches, selection_rect, | 1146 delegate()->FindReply(this, request_id, number_of_matches, selection_rect, |
1146 active_match_ordinal, final_update); | 1147 active_match_ordinal, final_update); |
1147 } | 1148 } |
1148 | 1149 |
| 1150 void TabContents::OnCrashedPlugin(const FilePath& plugin_path) { |
| 1151 delegate()->CrashedPlugin(this, plugin_path); |
| 1152 } |
| 1153 |
1149 // Notifies the RenderWidgetHost instance about the fact that the page is | 1154 // Notifies the RenderWidgetHost instance about the fact that the page is |
1150 // loading, or done loading and calls the base implementation. | 1155 // loading, or done loading and calls the base implementation. |
1151 void TabContents::SetIsLoading(bool is_loading, | 1156 void TabContents::SetIsLoading(bool is_loading, |
1152 LoadNotificationDetails* details) { | 1157 LoadNotificationDetails* details) { |
1153 if (is_loading == is_loading_) | 1158 if (is_loading == is_loading_) |
1154 return; | 1159 return; |
1155 | 1160 |
1156 if (!is_loading) { | 1161 if (!is_loading) { |
1157 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); | 1162 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); |
1158 load_state_host_.clear(); | 1163 load_state_host_.clear(); |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 1604 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
1600 } | 1605 } |
1601 | 1606 |
1602 void TabContents::UpdateEncoding(RenderViewHost* render_view_host, | 1607 void TabContents::UpdateEncoding(RenderViewHost* render_view_host, |
1603 const std::string& encoding) { | 1608 const std::string& encoding) { |
1604 set_encoding(encoding); | 1609 set_encoding(encoding); |
1605 } | 1610 } |
1606 | 1611 |
1607 void TabContents::UpdateTargetURL(int32 page_id, const GURL& url) { | 1612 void TabContents::UpdateTargetURL(int32 page_id, const GURL& url) { |
1608 if (delegate()) | 1613 if (delegate()) |
1609 delegate()->UpdateTargetURL(this, url); | 1614 delegate()->UpdateTargetURL(this, page_id, url); |
1610 } | 1615 } |
1611 | 1616 |
1612 void TabContents::Close(RenderViewHost* rvh) { | 1617 void TabContents::Close(RenderViewHost* rvh) { |
1613 // The UI may be in an event-tracking loop, such as between the | 1618 // The UI may be in an event-tracking loop, such as between the |
1614 // mouse-down and mouse-up in text selection or a button click. | 1619 // mouse-down and mouse-up in text selection or a button click. |
1615 // Defer the close until after tracking is complete, so that we | 1620 // Defer the close until after tracking is complete, so that we |
1616 // don't free objects out from under the UI. | 1621 // don't free objects out from under the UI. |
1617 // TODO(shess): This could probably be integrated with the | 1622 // TODO(shess): This could probably be integrated with the |
1618 // IsDoingDrag() test below. Punting for now because I need more | 1623 // IsDoingDrag() test below. Punting for now because I need more |
1619 // research to understand how this impacts platforms other than Mac. | 1624 // research to understand how this impacts platforms other than Mac. |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 } | 2000 } |
1996 | 2001 |
1997 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 2002 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
1998 render_manager_.SwapInRenderViewHost(rvh); | 2003 render_manager_.SwapInRenderViewHost(rvh); |
1999 } | 2004 } |
2000 | 2005 |
2001 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2006 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2002 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2007 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2003 rwh_view->SetSize(view()->GetContainerSize()); | 2008 rwh_view->SetSize(view()->GetContainerSize()); |
2004 } | 2009 } |
OLD | NEW |