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

Side by Side Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 6374009: Get rid of a few more interfaces from RenderViewHostDelegate that aren't need... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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) 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/renderer_host/render_view_host.h" 5 #include "chrome/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) 756 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading)
757 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) 757 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading)
758 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress, 758 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress,
759 OnMsgDidChangeLoadProgress) 759 OnMsgDidChangeLoadProgress)
760 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, 760 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame,
761 OnMsgDocumentAvailableInMainFrame) 761 OnMsgDocumentAvailableInMainFrame)
762 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, 762 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame,
763 OnMsgDocumentOnLoadCompletedInMainFrame) 763 OnMsgDocumentOnLoadCompletedInMainFrame)
764 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished, 764 IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished,
765 OnExecuteCodeFinished) 765 OnExecuteCodeFinished)
766 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFavIconURL, OnMsgUpdateFavIconURL)
767 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDownloadFavIcon, OnMsgDidDownloadFavIcon)
768 IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu) 766 IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu)
769 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) 767 IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL)
770 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, 768 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange,
771 OnMsgDidContentsPreferredSizeChange) 769 OnMsgDidContentsPreferredSizeChange)
772 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, 770 IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
773 OnMsgDomOperationResponse) 771 OnMsgDomOperationResponse)
774 IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend) 772 IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend)
775 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, 773 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost,
776 OnMsgForwardMessageToExternalHost) 774 OnMsgForwardMessageToExternalHost)
777 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) 775 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
778 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnMsgRunFileChooser)
779 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, 776 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage,
780 OnMsgRunJavaScriptMessage) 777 OnMsgRunJavaScriptMessage)
781 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, 778 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm,
782 OnMsgRunBeforeUnloadConfirm) 779 OnMsgRunBeforeUnloadConfirm)
783 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, 780 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog,
784 OnMsgShowModalHTMLDialog) 781 OnMsgShowModalHTMLDialog)
785 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) 782 IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging)
786 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) 783 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor)
787 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) 784 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
788 IPC_MESSAGE_HANDLER(ViewHostMsg_PageHasOSDD, OnMsgPageHasOSDD) 785 IPC_MESSAGE_HANDLER(ViewHostMsg_PageHasOSDD, OnMsgPageHasOSDD)
789 IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetPrintedPagesCount,
790 OnDidGetPrintedPagesCount)
791 IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, DidPrintPage)
792 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) 786 IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole)
793 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, 787 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent,
794 OnForwardToDevToolsAgent) 788 OnForwardToDevToolsAgent)
795 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, 789 IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient,
796 OnForwardToDevToolsClient) 790 OnForwardToDevToolsClient)
797 IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, 791 IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow,
798 OnActivateDevToolsWindow) 792 OnActivateDevToolsWindow)
799 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, 793 IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow,
800 OnCloseDevToolsWindow) 794 OnCloseDevToolsWindow)
801 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow, 795 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow,
802 OnRequestDockDevToolsWindow) 796 OnRequestDockDevToolsWindow)
803 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow, 797 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow,
804 OnRequestUndockDevToolsWindow) 798 OnRequestUndockDevToolsWindow)
805 IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimePropertyChanged, 799 IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimePropertyChanged,
806 OnDevToolsRuntimePropertyChanged) 800 OnDevToolsRuntimePropertyChanged)
807 IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks,
808 OnReceivedSavableResourceLinksForCurrentPage)
809 IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData,
810 OnReceivedSerializedHtmlData)
811 IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, 801 IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_,
812 RenderViewHostDelegate::OnJSOutOfMemory) 802 RenderViewHostDelegate::OnJSOutOfMemory)
813 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) 803 IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK)
814 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotification, 804 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDesktopNotification,
815 OnShowDesktopNotification) 805 OnShowDesktopNotification)
816 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelDesktopNotification, 806 IPC_MESSAGE_HANDLER(ViewHostMsg_CancelDesktopNotification,
817 OnCancelDesktopNotification) 807 OnCancelDesktopNotification)
818 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestNotificationPermission, 808 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestNotificationPermission,
819 OnRequestNotificationPermission) 809 OnRequestNotificationPermission)
820 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRequest, OnExtensionRequest) 810 IPC_MESSAGE_HANDLER(ViewHostMsg_ExtensionRequest, OnExtensionRequest)
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1085 }
1096 1086
1097 void RenderViewHost::OnExecuteCodeFinished(int request_id, bool success) { 1087 void RenderViewHost::OnExecuteCodeFinished(int request_id, bool success) {
1098 std::pair<int, bool> result_details(request_id, success); 1088 std::pair<int, bool> result_details(request_id, success);
1099 NotificationService::current()->Notify( 1089 NotificationService::current()->Notify(
1100 NotificationType::TAB_CODE_EXECUTED, 1090 NotificationType::TAB_CODE_EXECUTED,
1101 NotificationService::AllSources(), 1091 NotificationService::AllSources(),
1102 Details<std::pair<int, bool> >(&result_details)); 1092 Details<std::pair<int, bool> >(&result_details));
1103 } 1093 }
1104 1094
1105 void RenderViewHost::OnMsgUpdateFavIconURL(int32 page_id,
1106 const GURL& icon_url) {
1107 RenderViewHostDelegate::FavIcon* favicon_delegate =
1108 delegate_->GetFavIconDelegate();
1109 if (favicon_delegate)
1110 favicon_delegate->UpdateFavIconURL(this, page_id, icon_url);
1111 }
1112
1113 void RenderViewHost::OnMsgDidDownloadFavIcon(int id,
1114 const GURL& image_url,
1115 bool errored,
1116 const SkBitmap& image) {
1117 RenderViewHostDelegate::FavIcon* favicon_delegate =
1118 delegate_->GetFavIconDelegate();
1119 if (favicon_delegate)
1120 favicon_delegate->DidDownloadFavIcon(this, id, image_url, errored, image);
1121 }
1122
1123 void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) { 1095 void RenderViewHost::OnMsgContextMenu(const ContextMenuParams& params) {
1124 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); 1096 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1125 if (!view) 1097 if (!view)
1126 return; 1098 return;
1127 1099
1128 // Validate the URLs in |params|. If the renderer can't request the URLs 1100 // Validate the URLs in |params|. If the renderer can't request the URLs
1129 // directly, don't show them in the context menu. 1101 // directly, don't show them in the context menu.
1130 ContextMenuParams validated_params(params); 1102 ContextMenuParams validated_params(params);
1131 int renderer_id = process()->id(); 1103 int renderer_id = process()->id();
1132 ChildProcessSecurityPolicy* policy = 1104 ChildProcessSecurityPolicy* policy =
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 } 1222 }
1251 if (view()) 1223 if (view())
1252 view()->SetTooltipText(wrapped_tooltip_text); 1224 view()->SetTooltipText(wrapped_tooltip_text);
1253 } 1225 }
1254 1226
1255 void RenderViewHost::OnMsgSelectionChanged(const std::string& text) { 1227 void RenderViewHost::OnMsgSelectionChanged(const std::string& text) {
1256 if (view()) 1228 if (view())
1257 view()->SelectionChanged(text); 1229 view()->SelectionChanged(text);
1258 } 1230 }
1259 1231
1260 void RenderViewHost::OnMsgRunFileChooser(
1261 const ViewHostMsg_RunFileChooser_Params& params) {
1262 RenderViewHostDelegate::FileSelect* file_select_delegate =
1263 delegate()->GetFileSelectDelegate();
1264 if (file_select_delegate)
1265 file_select_delegate->RunFileChooser(this, params);
1266 }
1267
1268 void RenderViewHost::OnMsgRunJavaScriptMessage( 1232 void RenderViewHost::OnMsgRunJavaScriptMessage(
1269 const std::wstring& message, 1233 const std::wstring& message,
1270 const std::wstring& default_prompt, 1234 const std::wstring& default_prompt,
1271 const GURL& frame_url, 1235 const GURL& frame_url,
1272 const int flags, 1236 const int flags,
1273 IPC::Message* reply_msg) { 1237 IPC::Message* reply_msg) {
1274 // While a JS message dialog is showing, tabs in the same process shouldn't 1238 // While a JS message dialog is showing, tabs in the same process shouldn't
1275 // process input events. 1239 // process input events.
1276 process()->set_ignore_input_events(true); 1240 process()->set_ignore_input_events(true);
1277 StopHangMonitorTimeout(); 1241 StopHangMonitorTimeout();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 view->TakeFocus(reverse); 1297 view->TakeFocus(reverse);
1334 } 1298 }
1335 1299
1336 void RenderViewHost::OnMsgPageHasOSDD( 1300 void RenderViewHost::OnMsgPageHasOSDD(
1337 int32 page_id, 1301 int32 page_id,
1338 const GURL& doc_url, 1302 const GURL& doc_url,
1339 const ViewHostMsg_PageHasOSDD_Type& provider_type) { 1303 const ViewHostMsg_PageHasOSDD_Type& provider_type) {
1340 delegate_->PageHasOSDD(this, page_id, doc_url, provider_type); 1304 delegate_->PageHasOSDD(this, page_id, doc_url, provider_type);
1341 } 1305 }
1342 1306
1343 void RenderViewHost::OnDidGetPrintedPagesCount(int cookie, int number_pages) {
1344 RenderViewHostDelegate::Printing* printing_delegate =
1345 delegate_->GetPrintingDelegate();
1346 if (printing_delegate)
1347 printing_delegate->DidGetPrintedPagesCount(cookie, number_pages);
1348 }
1349
1350 void RenderViewHost::DidPrintPage(
1351 const ViewHostMsg_DidPrintPage_Params& params) {
1352 RenderViewHostDelegate::Printing* printing_delegate =
1353 delegate_->GetPrintingDelegate();
1354 if (printing_delegate)
1355 printing_delegate->DidPrintPage(params);
1356 }
1357
1358 void RenderViewHost::OnAddMessageToConsole(const std::wstring& message, 1307 void RenderViewHost::OnAddMessageToConsole(const std::wstring& message,
1359 int32 line_no, 1308 int32 line_no,
1360 const std::wstring& source_id) { 1309 const std::wstring& source_id) {
1361 std::wstring msg = StringPrintf(L"\"%ls,\" source: %ls (%d)", message.c_str(), 1310 std::wstring msg = StringPrintf(L"\"%ls,\" source: %ls (%d)", message.c_str(),
1362 source_id.c_str(), line_no); 1311 source_id.c_str(), line_no);
1363 logging::LogMessage("CONSOLE", 0).stream() << msg; 1312 logging::LogMessage("CONSOLE", 0).stream() << msg;
1364 } 1313 }
1365 1314
1366 void RenderViewHost::OnForwardToDevToolsAgent(const IPC::Message& message) { 1315 void RenderViewHost::OnForwardToDevToolsAgent(const IPC::Message& message) {
1367 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message); 1316 DevToolsManager::GetInstance()->ForwardToDevToolsAgent(this, message);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 void RenderViewHost::OnUserGesture() { 1359 void RenderViewHost::OnUserGesture() {
1411 delegate_->OnUserGesture(); 1360 delegate_->OnUserGesture();
1412 } 1361 }
1413 1362
1414 void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( 1363 void RenderViewHost::GetAllSavableResourceLinksForCurrentPage(
1415 const GURL& page_url) { 1364 const GURL& page_url) {
1416 Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(), 1365 Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id(),
1417 page_url)); 1366 page_url));
1418 } 1367 }
1419 1368
1420 void RenderViewHost::OnReceivedSavableResourceLinksForCurrentPage(
1421 const std::vector<GURL>& resources_list,
1422 const std::vector<GURL>& referrers_list,
1423 const std::vector<GURL>& frames_list) {
1424 RenderViewHostDelegate::Save* save_delegate = delegate_->GetSaveDelegate();
1425 if (save_delegate) {
1426 save_delegate->OnReceivedSavableResourceLinksForCurrentPage(
1427 resources_list, referrers_list, frames_list);
1428 }
1429 }
1430
1431 void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks( 1369 void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks(
1432 const std::vector<GURL>& links, 1370 const std::vector<GURL>& links,
1433 const std::vector<FilePath>& local_paths, 1371 const std::vector<FilePath>& local_paths,
1434 const FilePath& local_directory_name) { 1372 const FilePath& local_directory_name) {
1435 Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( 1373 Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks(
1436 routing_id(), links, local_paths, local_directory_name)); 1374 routing_id(), links, local_paths, local_directory_name));
1437 } 1375 }
1438 1376
1439 void RenderViewHost::OnReceivedSerializedHtmlData(const GURL& frame_url,
1440 const std::string& data,
1441 int32 status) {
1442 RenderViewHostDelegate::Save* save_delegate = delegate_->GetSaveDelegate();
1443 if (save_delegate)
1444 save_delegate->OnReceivedSerializedHtmlData(frame_url, data, status);
1445 }
1446
1447 void RenderViewHost::OnMsgShouldCloseACK(bool proceed) { 1377 void RenderViewHost::OnMsgShouldCloseACK(bool proceed) {
1448 StopHangMonitorTimeout(); 1378 StopHangMonitorTimeout();
1449 // If this renderer navigated while the beforeunload request was in flight, we 1379 // If this renderer navigated while the beforeunload request was in flight, we
1450 // may have cleared this state in OnMsgNavigate, in which case we can ignore 1380 // may have cleared this state in OnMsgNavigate, in which case we can ignore
1451 // this message. 1381 // this message.
1452 if (!is_waiting_for_beforeunload_ack_) 1382 if (!is_waiting_for_beforeunload_ack_)
1453 return; 1383 return;
1454 1384
1455 is_waiting_for_beforeunload_ack_ = false; 1385 is_waiting_for_beforeunload_ack_ = false;
1456 1386
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 if (printer_query.get()) { 1780 if (printer_query.get()) {
1851 BrowserThread::PostTask( 1781 BrowserThread::PostTask(
1852 BrowserThread::IO, FROM_HERE, 1782 BrowserThread::IO, FROM_HERE,
1853 NewRunnableMethod(printer_query.get(), 1783 NewRunnableMethod(printer_query.get(),
1854 &printing::PrinterQuery::StopWorker)); 1784 &printing::PrinterQuery::StopWorker));
1855 } 1785 }
1856 1786
1857 // Send the printingDone msg for now. 1787 // Send the printingDone msg for now.
1858 Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true)); 1788 Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true));
1859 } 1789 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | chrome/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698