| 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/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  | 
|    11 #include "base/command_line.h" |    11 #include "base/command_line.h" | 
|    12 #include "base/i18n/rtl.h" |    12 #include "base/i18n/rtl.h" | 
|    13 #include "base/json/json_reader.h" |    13 #include "base/json/json_reader.h" | 
|    14 #include "base/metrics/stats_counters.h" |  | 
|    15 #include "base/string_util.h" |    14 #include "base/string_util.h" | 
|    16 #include "base/time.h" |    15 #include "base/time.h" | 
|    17 #include "base/utf_string_conversions.h" |    16 #include "base/utf_string_conversions.h" | 
|    18 #include "base/values.h" |    17 #include "base/values.h" | 
|    19 #include "chrome/browser/browser_list.h" |    18 #include "chrome/browser/browser_list.h" | 
|    20 #include "chrome/browser/browser_process.h" |    19 #include "chrome/browser/browser_process.h" | 
|    21 #include "chrome/browser/browser_thread.h" |    20 #include "chrome/browser/browser_thread.h" | 
|    22 #include "chrome/browser/child_process_security_policy.h" |    21 #include "chrome/browser/child_process_security_policy.h" | 
|    23 #include "chrome/browser/cross_site_request_manager.h" |    22 #include "chrome/browser/cross_site_request_manager.h" | 
|    24 #include "chrome/browser/debugger/devtools_manager.h" |    23 #include "chrome/browser/debugger/devtools_manager.h" | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    74 using WebKit::WebDragOperation; |    73 using WebKit::WebDragOperation; | 
|    75 using WebKit::WebDragOperationNone; |    74 using WebKit::WebDragOperationNone; | 
|    76 using WebKit::WebDragOperationsMask; |    75 using WebKit::WebDragOperationsMask; | 
|    77 using WebKit::WebFindOptions; |    76 using WebKit::WebFindOptions; | 
|    78 using WebKit::WebInputEvent; |    77 using WebKit::WebInputEvent; | 
|    79 using WebKit::WebMediaPlayerAction; |    78 using WebKit::WebMediaPlayerAction; | 
|    80 using WebKit::WebTextDirection; |    79 using WebKit::WebTextDirection; | 
|    81  |    80  | 
|    82 namespace { |    81 namespace { | 
|    83  |    82  | 
|    84 void FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) { |  | 
|    85   if (!url->is_valid()) |  | 
|    86     return;  // We don't need to block invalid URLs. |  | 
|    87  |  | 
|    88   if (url->SchemeIs(chrome::kAboutScheme)) { |  | 
|    89     // The renderer treats all URLs in the about: scheme as being about:blank. |  | 
|    90     // Canonicalize about: URLs to about:blank. |  | 
|    91     *url = GURL(chrome::kAboutBlankURL); |  | 
|    92   } |  | 
|    93  |  | 
|    94   if (!policy->CanRequestURL(renderer_id, *url)) { |  | 
|    95     // If this renderer is not permitted to request this URL, we invalidate the |  | 
|    96     // URL.  This prevents us from storing the blocked URL and becoming confused |  | 
|    97     // later. |  | 
|    98     VLOG(1) << "Blocked URL " << url->spec(); |  | 
|    99     *url = GURL(); |  | 
|   100   } |  | 
|   101 } |  | 
|   102  |  | 
|   103 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. |    83 // Delay to wait on closing the tab for a beforeunload/unload handler to fire. | 
|   104 const int kUnloadTimeoutMS = 1000; |    84 const int kUnloadTimeoutMS = 1000; | 
|   105  |    85  | 
|   106 }  // namespace |    86 }  // namespace | 
|   107  |    87  | 
|   108 /////////////////////////////////////////////////////////////////////////////// |    88 /////////////////////////////////////////////////////////////////////////////// | 
|   109 // RenderViewHost, public: |    89 // RenderViewHost, public: | 
|   110  |    90  | 
|   111 // static |    91 // static | 
|   112 RenderViewHost* RenderViewHost::FromID(int render_process_id, |    92 RenderViewHost* RenderViewHost::FromID(int render_process_id, | 
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   753     NOTREACHED() << "Can't send sync messages to UI thread without pumping " |   733     NOTREACHED() << "Can't send sync messages to UI thread without pumping " | 
|   754         "messages in the renderer or else deadlocks can occur if the page " |   734         "messages in the renderer or else deadlocks can occur if the page " | 
|   755         "has windowed plugins! (message type " << msg.type() << ")"; |   735         "has windowed plugins! (message type " << msg.type() << ")"; | 
|   756     IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |   736     IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | 
|   757     reply->set_reply_error(); |   737     reply->set_reply_error(); | 
|   758     Send(reply); |   738     Send(reply); | 
|   759     return true; |   739     return true; | 
|   760   } |   740   } | 
|   761 #endif |   741 #endif | 
|   762  |   742  | 
 |   743   if (delegate_->OnMessageReceived(msg)) | 
 |   744     return true; | 
 |   745  | 
|   763   bool handled = true; |   746   bool handled = true; | 
|   764   bool msg_is_ok = true; |   747   bool msg_is_ok = true; | 
|   765   IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) |   748   IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) | 
|   766     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |   749     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 
|   767     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |   750     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 
|   768     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |   751     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 
|   769                         OnMsgShowFullscreenWidget) |   752                         OnMsgShowFullscreenWidget) | 
|   770     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) |   753     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) | 
|   771     IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) |   754     IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) | 
|   772     IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |   755     IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 
|   773     IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) |   756     IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) | 
|   774     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) |   757     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) | 
|   775     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) |   758     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) | 
|   776     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) |   759     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) | 
|   777     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) |   760     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) | 
|   778     IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail) |   761     IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail) | 
|   779     IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnMsgScreenshot) |   762     IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnMsgScreenshot) | 
|   780     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting, |   763     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting, | 
|   781                         OnUpdateInspectorSetting); |   764                         OnUpdateInspectorSetting) | 
|   782     IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |   765     IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 
|   783     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |   766     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 
|   784     IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) |   767     IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) | 
|   785     IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) |   768     IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) | 
|   786     IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress, |   769     IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeLoadProgress, | 
|   787                         OnMsgDidChangeLoadProgress) |   770                         OnMsgDidChangeLoadProgress) | 
|   788     IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |   771     IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 
|   789                         OnMsgDocumentAvailableInMainFrame) |   772                         OnMsgDocumentAvailableInMainFrame) | 
|   790     IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, |   773     IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame, | 
|   791                         OnMsgDocumentOnLoadCompletedInMainFrame) |   774                         OnMsgDocumentOnLoadCompletedInMainFrame) | 
|   792     IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |  | 
|   793                         OnMsgDidLoadResourceFromMemoryCache) |  | 
|   794     IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |  | 
|   795                         OnMsgDidDisplayInsecureContent) |  | 
|   796     IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |  | 
|   797                         OnMsgDidRunInsecureContent) |  | 
|   798     IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad, |  | 
|   799                         OnMsgDidRedirectProvisionalLoad) |  | 
|   800     IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, |  | 
|   801                         OnMsgDidStartProvisionalLoadForFrame) |  | 
|   802     IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError, |  | 
|   803                         OnMsgDidFailProvisionalLoadWithError) |  | 
|   804     IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnMsgFindReply) |   775     IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnMsgFindReply) | 
|   805     IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished, |   776     IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished, | 
|   806                         OnExecuteCodeFinished) |   777                         OnExecuteCodeFinished) | 
|   807     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFavIconURL, OnMsgUpdateFavIconURL) |   778     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFavIconURL, OnMsgUpdateFavIconURL) | 
|   808     IPC_MESSAGE_HANDLER(ViewHostMsg_DidDownloadFavIcon, OnMsgDidDownloadFavIcon) |   779     IPC_MESSAGE_HANDLER(ViewHostMsg_DidDownloadFavIcon, OnMsgDidDownloadFavIcon) | 
|   809     IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu) |   780     IPC_MESSAGE_HANDLER(ViewHostMsg_ContextMenu, OnMsgContextMenu) | 
|   810     IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) |   781     IPC_MESSAGE_HANDLER(ViewHostMsg_OpenURL, OnMsgOpenURL) | 
|   811     IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |   782     IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 
|   812                         OnMsgDidContentsPreferredSizeChange) |   783                         OnMsgDidContentsPreferredSizeChange) | 
|   813     IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, |   784     IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse, | 
|   814                         OnMsgDomOperationResponse) |   785                         OnMsgDomOperationResponse) | 
|   815     IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, |   786     IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend) | 
|   816                         OnMsgDOMUISend) |  | 
|   817     IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, |   787     IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost, | 
|   818                         OnMsgForwardMessageToExternalHost) |   788                         OnMsgForwardMessageToExternalHost) | 
|   819     IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |   789     IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnMsgGoToEntryAtOffset) | 
|   820                         OnMsgDocumentLoadedInFrame) |  | 
|   821     IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, |  | 
|   822                         OnMsgDidFinishLoad) |  | 
|   823     IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, |  | 
|   824                         OnMsgGoToEntryAtOffset) |  | 
|   825     IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |   790     IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 
|   826     IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnMsgRunFileChooser) |   791     IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnMsgRunFileChooser) | 
|   827     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, |   792     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage, | 
|   828                                     OnMsgRunJavaScriptMessage) |   793                                     OnMsgRunJavaScriptMessage) | 
|   829     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, |   794     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunBeforeUnloadConfirm, | 
|   830                                     OnMsgRunBeforeUnloadConfirm) |   795                                     OnMsgRunBeforeUnloadConfirm) | 
|   831     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, |   796     IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ShowModalHTMLDialog, | 
|   832                                     OnMsgShowModalHTMLDialog) |   797                                     OnMsgShowModalHTMLDialog) | 
|   833     IPC_MESSAGE_HANDLER(ViewHostMsg_FormsSeen, OnMsgFormsSeen) |   798     IPC_MESSAGE_HANDLER(ViewHostMsg_FormsSeen, OnMsgFormsSeen) | 
|   834     IPC_MESSAGE_HANDLER(ViewHostMsg_PasswordFormsFound, OnMsgPasswordFormsFound) |   799     IPC_MESSAGE_HANDLER(ViewHostMsg_PasswordFormsFound, OnMsgPasswordFormsFound) | 
|   835     IPC_MESSAGE_HANDLER(ViewHostMsg_PasswordFormsVisible, |   800     IPC_MESSAGE_HANDLER(ViewHostMsg_PasswordFormsVisible, | 
|   836                         OnMsgPasswordFormsVisible) |   801                         OnMsgPasswordFormsVisible) | 
|   837     IPC_MESSAGE_HANDLER(ViewHostMsg_FormSubmitted, OnMsgFormSubmitted) |   802     IPC_MESSAGE_HANDLER(ViewHostMsg_FormSubmitted, OnMsgFormSubmitted) | 
|   838     IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) |   803     IPC_MESSAGE_HANDLER(ViewHostMsg_StartDragging, OnMsgStartDragging) | 
|   839     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) |   804     IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 
|   840     IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |   805     IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 
|   841     IPC_MESSAGE_HANDLER(ViewHostMsg_PageHasOSDD, OnMsgPageHasOSDD) |   806     IPC_MESSAGE_HANDLER(ViewHostMsg_PageHasOSDD, OnMsgPageHasOSDD) | 
|   842     IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetPrintedPagesCount, |   807     IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetPrintedPagesCount, | 
|   843                         OnDidGetPrintedPagesCount) |   808                         OnDidGetPrintedPagesCount) | 
|   844     IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, DidPrintPage) |   809     IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, DidPrintPage) | 
|   845     IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) |   810     IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole) | 
|   846     IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, |   811     IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent, | 
|   847                         OnForwardToDevToolsAgent); |   812                         OnForwardToDevToolsAgent) | 
|   848     IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, |   813     IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient, | 
|   849                         OnForwardToDevToolsClient); |   814                         OnForwardToDevToolsClient) | 
|   850     IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, |   815     IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow, | 
|   851                         OnActivateDevToolsWindow); |   816                         OnActivateDevToolsWindow) | 
|   852     IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, |   817     IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow, | 
|   853                         OnCloseDevToolsWindow); |   818                         OnCloseDevToolsWindow) | 
|   854     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow, |   819     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow, | 
|   855                         OnRequestDockDevToolsWindow); |   820                         OnRequestDockDevToolsWindow) | 
|   856     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow, |   821     IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow, | 
|   857                         OnRequestUndockDevToolsWindow); |   822                         OnRequestUndockDevToolsWindow) | 
|   858     IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimePropertyChanged, |   823     IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimePropertyChanged, | 
|   859                         OnDevToolsRuntimePropertyChanged); |   824                         OnDevToolsRuntimePropertyChanged) | 
|   860     IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus); |   825     IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus) | 
|   861     IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin); |   826     IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) | 
|   862     IPC_MESSAGE_HANDLER(ViewHostMsg_BlockedOutdatedPlugin, |   827     IPC_MESSAGE_HANDLER(ViewHostMsg_BlockedOutdatedPlugin, | 
|   863                         OnBlockedOutdatedPlugin); |   828                         OnBlockedOutdatedPlugin) | 
|   864     IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, |   829     IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks, | 
|   865                         OnReceivedSavableResourceLinksForCurrentPage); |   830                         OnReceivedSavableResourceLinksForCurrentPage) | 
|   866     IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData, |   831     IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData, | 
|   867                         OnReceivedSerializedHtmlData); |   832                         OnReceivedSerializedHtmlData) | 
|   868     IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, |   833     IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo, | 
|   869                         OnDidGetApplicationInfo); |   834                         OnDidGetApplicationInfo) | 
|   870     IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, |   835     IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication, | 
|   871                         OnInstallApplication); |   836                         OnInstallApplication) | 
|   872     IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, |   837     IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_, | 
|   873                         RenderViewHostDelegate::OnJSOutOfMemory); |   838                         RenderViewHostDelegate::OnJSOutOfMemory) | 
|   874     IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); |   839     IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK) | 
|   875     IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill, |   840     IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill, | 
|   876                         OnQueryFormFieldAutoFill) |   841                         OnQueryFormFieldAutoFill) | 
|   877     IPC_MESSAGE_HANDLER(ViewHostMsg_DidShowAutoFillSuggestions, |   842     IPC_MESSAGE_HANDLER(ViewHostMsg_DidShowAutoFillSuggestions, | 
|   878                         OnDidShowAutoFillSuggestions) |   843                         OnDidShowAutoFillSuggestions) | 
|   879     IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutocompleteEntry, |   844     IPC_MESSAGE_HANDLER(ViewHostMsg_RemoveAutocompleteEntry, | 
|   880                         OnRemoveAutocompleteEntry) |   845                         OnRemoveAutocompleteEntry) | 
|   881     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowAutoFillDialog, |   846     IPC_MESSAGE_HANDLER(ViewHostMsg_ShowAutoFillDialog, | 
|   882                         OnShowAutoFillDialog) |   847                         OnShowAutoFillDialog) | 
|   883     IPC_MESSAGE_HANDLER(ViewHostMsg_FillAutoFillFormData, |   848     IPC_MESSAGE_HANDLER(ViewHostMsg_FillAutoFillFormData, | 
|   884                         OnFillAutoFillFormData) |   849                         OnFillAutoFillFormData) | 
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1148   // If the renderer is telling us to close, it has already run the unload |  1113   // If the renderer is telling us to close, it has already run the unload | 
|  1149   // events, and we can take the fast path. |  1114   // events, and we can take the fast path. | 
|  1150   ClosePageIgnoringUnloadEvents(); |  1115   ClosePageIgnoringUnloadEvents(); | 
|  1151 } |  1116 } | 
|  1152  |  1117  | 
|  1153 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { |  1118 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { | 
|  1154   delegate_->RequestMove(pos); |  1119   delegate_->RequestMove(pos); | 
|  1155   Send(new ViewMsg_Move_ACK(routing_id())); |  1120   Send(new ViewMsg_Move_ACK(routing_id())); | 
|  1156 } |  1121 } | 
|  1157  |  1122  | 
|  1158 void RenderViewHost::OnMsgDidRedirectProvisionalLoad(int32 page_id, |  | 
|  1159                                                      const GURL& source_url, |  | 
|  1160                                                      const GURL& target_url) { |  | 
|  1161   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1162       delegate_->GetResourceDelegate(); |  | 
|  1163   if (resource_delegate) { |  | 
|  1164     resource_delegate->DidRedirectProvisionalLoad(page_id, |  | 
|  1165                                                   source_url, target_url); |  | 
|  1166   } |  | 
|  1167 } |  | 
|  1168  |  | 
|  1169 void RenderViewHost::OnMsgDidStartLoading() { |  1123 void RenderViewHost::OnMsgDidStartLoading() { | 
|  1170   delegate_->DidStartLoading(); |  1124   delegate_->DidStartLoading(); | 
|  1171 } |  1125 } | 
|  1172  |  1126  | 
|  1173 void RenderViewHost::OnMsgDidStopLoading() { |  1127 void RenderViewHost::OnMsgDidStopLoading() { | 
|  1174   delegate_->DidStopLoading(); |  1128   delegate_->DidStopLoading(); | 
|  1175 } |  1129 } | 
|  1176  |  1130  | 
|  1177 void RenderViewHost::OnMsgDidChangeLoadProgress(double load_progress) { |  1131 void RenderViewHost::OnMsgDidChangeLoadProgress(double load_progress) { | 
|  1178   delegate_->DidChangeLoadProgress(load_progress); |  1132   delegate_->DidChangeLoadProgress(load_progress); | 
|  1179 } |  1133 } | 
|  1180  |  1134  | 
|  1181 void RenderViewHost::OnMsgDocumentAvailableInMainFrame() { |  1135 void RenderViewHost::OnMsgDocumentAvailableInMainFrame() { | 
|  1182   delegate_->DocumentAvailableInMainFrame(this); |  1136   delegate_->DocumentAvailableInMainFrame(this); | 
|  1183 } |  1137 } | 
|  1184  |  1138  | 
|  1185 void RenderViewHost::OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id) { |  1139 void RenderViewHost::OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id) { | 
|  1186   delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); |  1140   delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id); | 
|  1187 } |  1141 } | 
|  1188  |  1142  | 
|  1189 void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache( |  | 
|  1190     const GURL& url, |  | 
|  1191     const std::string& frame_origin, |  | 
|  1192     const std::string& main_frame_origin, |  | 
|  1193     const std::string& security_info) { |  | 
|  1194   static base::StatsCounter cache("WebKit.CacheHit"); |  | 
|  1195   cache.Increment(); |  | 
|  1196  |  | 
|  1197   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1198       delegate_->GetResourceDelegate(); |  | 
|  1199   if (resource_delegate) { |  | 
|  1200     resource_delegate->DidLoadResourceFromMemoryCache( |  | 
|  1201         url, frame_origin, main_frame_origin, security_info); |  | 
|  1202   } |  | 
|  1203 } |  | 
|  1204  |  | 
|  1205 void RenderViewHost::OnMsgDidDisplayInsecureContent() { |  | 
|  1206   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1207       delegate_->GetResourceDelegate(); |  | 
|  1208   if (resource_delegate) |  | 
|  1209     resource_delegate->DidDisplayInsecureContent(); |  | 
|  1210 } |  | 
|  1211  |  | 
|  1212 void RenderViewHost::OnMsgDidRunInsecureContent( |  | 
|  1213     const std::string& security_origin) { |  | 
|  1214   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1215       delegate_->GetResourceDelegate(); |  | 
|  1216   if (resource_delegate) |  | 
|  1217     resource_delegate->DidRunInsecureContent(security_origin); |  | 
|  1218 } |  | 
|  1219  |  | 
|  1220 void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(int64 frame_id, |  | 
|  1221                                                           bool is_main_frame, |  | 
|  1222                                                           const GURL& url) { |  | 
|  1223   bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL); |  | 
|  1224   GURL validated_url(url); |  | 
|  1225   FilterURL(ChildProcessSecurityPolicy::GetInstance(), |  | 
|  1226             process()->id(), &validated_url); |  | 
|  1227  |  | 
|  1228   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1229       delegate_->GetResourceDelegate(); |  | 
|  1230   if (resource_delegate) { |  | 
|  1231     resource_delegate->DidStartProvisionalLoadForFrame( |  | 
|  1232         this, frame_id, is_main_frame, is_error_page, validated_url); |  | 
|  1233   } |  | 
|  1234 } |  | 
|  1235  |  | 
|  1236 void RenderViewHost::OnMsgDidFailProvisionalLoadWithError( |  | 
|  1237     int64 frame_id, |  | 
|  1238     bool is_main_frame, |  | 
|  1239     int error_code, |  | 
|  1240     const GURL& url, |  | 
|  1241     bool showing_repost_interstitial) { |  | 
|  1242   VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec() |  | 
|  1243           << ", error_code: " << error_code |  | 
|  1244           << " is_main_frame: " << is_main_frame |  | 
|  1245           << " showing_repost_interstitial: " << showing_repost_interstitial |  | 
|  1246           << " frame_id: " << frame_id; |  | 
|  1247   GURL validated_url(url); |  | 
|  1248   FilterURL(ChildProcessSecurityPolicy::GetInstance(), |  | 
|  1249             process()->id(), &validated_url); |  | 
|  1250  |  | 
|  1251   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1252       delegate_->GetResourceDelegate(); |  | 
|  1253   if (resource_delegate) { |  | 
|  1254     resource_delegate->DidFailProvisionalLoadWithError( |  | 
|  1255         this, frame_id, is_main_frame, error_code, validated_url, |  | 
|  1256         showing_repost_interstitial); |  | 
|  1257   } |  | 
|  1258 } |  | 
|  1259  |  | 
|  1260 void RenderViewHost::OnMsgFindReply(int request_id, |  1143 void RenderViewHost::OnMsgFindReply(int request_id, | 
|  1261                                     int number_of_matches, |  1144                                     int number_of_matches, | 
|  1262                                     const gfx::Rect& selection_rect, |  1145                                     const gfx::Rect& selection_rect, | 
|  1263                                     int active_match_ordinal, |  1146                                     int active_match_ordinal, | 
|  1264                                     bool final_update) { |  1147                                     bool final_update) { | 
|  1265   RenderViewHostDelegate::BrowserIntegration* integration_delegate = |  1148   RenderViewHostDelegate::BrowserIntegration* integration_delegate = | 
|  1266       delegate_->GetBrowserIntegrationDelegate(); |  1149       delegate_->GetBrowserIntegrationDelegate(); | 
|  1267   if (integration_delegate) { |  1150   if (integration_delegate) { | 
|  1268     integration_delegate->OnFindReply(request_id, number_of_matches, |  1151     integration_delegate->OnFindReply(request_id, number_of_matches, | 
|  1269                                       selection_rect, |  1152                                       selection_rect, | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1389   params.user_gesture = false; |  1272   params.user_gesture = false; | 
|  1390   delegate_->ProcessDOMUIMessage(params); |  1273   delegate_->ProcessDOMUIMessage(params); | 
|  1391 } |  1274 } | 
|  1392  |  1275  | 
|  1393 void RenderViewHost::OnMsgForwardMessageToExternalHost( |  1276 void RenderViewHost::OnMsgForwardMessageToExternalHost( | 
|  1394     const std::string& message, const std::string& origin, |  1277     const std::string& message, const std::string& origin, | 
|  1395     const std::string& target) { |  1278     const std::string& target) { | 
|  1396   delegate_->ProcessExternalHostMessage(message, origin, target); |  1279   delegate_->ProcessExternalHostMessage(message, origin, target); | 
|  1397 } |  1280 } | 
|  1398  |  1281  | 
|  1399 void RenderViewHost::OnMsgDocumentLoadedInFrame(int64 frame_id) { |  | 
|  1400   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1401       delegate_->GetResourceDelegate(); |  | 
|  1402   if (resource_delegate) |  | 
|  1403     resource_delegate->DocumentLoadedInFrame(frame_id); |  | 
|  1404 } |  | 
|  1405  |  | 
|  1406 void RenderViewHost::OnMsgDidFinishLoad(int64 frame_id) { |  | 
|  1407   RenderViewHostDelegate::Resource* resource_delegate = |  | 
|  1408       delegate_->GetResourceDelegate(); |  | 
|  1409   if (resource_delegate) |  | 
|  1410     resource_delegate->DidFinishLoad(frame_id); |  | 
|  1411 } |  | 
|  1412  |  | 
|  1413 void RenderViewHost::DisassociateFromPopupCount() { |  1282 void RenderViewHost::DisassociateFromPopupCount() { | 
|  1414   Send(new ViewMsg_DisassociateFromPopupCount(routing_id())); |  1283   Send(new ViewMsg_DisassociateFromPopupCount(routing_id())); | 
|  1415 } |  1284 } | 
|  1416  |  1285  | 
|  1417 void RenderViewHost::AllowScriptToClose(bool script_can_close) { |  1286 void RenderViewHost::AllowScriptToClose(bool script_can_close) { | 
|  1418   Send(new ViewMsg_AllowScriptToClose(routing_id(), script_can_close)); |  1287   Send(new ViewMsg_AllowScriptToClose(routing_id(), script_can_close)); | 
|  1419 } |  1288 } | 
|  1420  |  1289  | 
|  1421 void RenderViewHost::OnMsgGoToEntryAtOffset(int offset) { |  1290 void RenderViewHost::OnMsgGoToEntryAtOffset(int offset) { | 
|  1422   RenderViewHostDelegate::BrowserIntegration* integration_delegate = |  1291   RenderViewHostDelegate::BrowserIntegration* integration_delegate = | 
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2086 void RenderViewHost::SearchBoxResize(const gfx::Rect& search_box_bounds) { |  1955 void RenderViewHost::SearchBoxResize(const gfx::Rect& search_box_bounds) { | 
|  2087   Send(new ViewMsg_SearchBoxResize(routing_id(), search_box_bounds)); |  1956   Send(new ViewMsg_SearchBoxResize(routing_id(), search_box_bounds)); | 
|  2088 } |  1957 } | 
|  2089  |  1958  | 
|  2090 void RenderViewHost::DetermineIfPageSupportsInstant(const string16& value, |  1959 void RenderViewHost::DetermineIfPageSupportsInstant(const string16& value, | 
|  2091                                                     bool verbatim) { |  1960                                                     bool verbatim) { | 
|  2092   Send(new ViewMsg_DetermineIfPageSupportsInstant(routing_id(), value, |  1961   Send(new ViewMsg_DetermineIfPageSupportsInstant(routing_id(), value, | 
|  2093                                                   verbatim)); |  1962                                                   verbatim)); | 
|  2094 } |  1963 } | 
|  2095  |  1964  | 
 |  1965 void RenderViewHost::FilterURL(ChildProcessSecurityPolicy* policy, | 
 |  1966                                int renderer_id, | 
 |  1967                                GURL* url) { | 
 |  1968   if (!url->is_valid()) | 
 |  1969     return;  // We don't need to block invalid URLs. | 
 |  1970  | 
 |  1971   if (url->SchemeIs(chrome::kAboutScheme)) { | 
 |  1972     // The renderer treats all URLs in the about: scheme as being about:blank. | 
 |  1973     // Canonicalize about: URLs to about:blank. | 
 |  1974     *url = GURL(chrome::kAboutBlankURL); | 
 |  1975   } | 
 |  1976  | 
 |  1977   if (!policy->CanRequestURL(renderer_id, *url)) { | 
 |  1978     // If this renderer is not permitted to request this URL, we invalidate the | 
 |  1979     // URL.  This prevents us from storing the blocked URL and becoming confused | 
 |  1980     // later. | 
 |  1981     VLOG(1) << "Blocked URL " << url->spec(); | 
 |  1982     *url = GURL(); | 
 |  1983   } | 
 |  1984 } | 
 |  1985  | 
|  2096 void RenderViewHost::OnExtensionPostMessage( |  1986 void RenderViewHost::OnExtensionPostMessage( | 
|  2097     int port_id, const std::string& message) { |  1987     int port_id, const std::string& message) { | 
|  2098   if (process()->profile()->GetExtensionMessageService()) { |  1988   if (process()->profile()->GetExtensionMessageService()) { | 
|  2099     process()->profile()->GetExtensionMessageService()-> |  1989     process()->profile()->GetExtensionMessageService()-> | 
|  2100         PostMessageFromRenderer(port_id, message); |  1990         PostMessageFromRenderer(port_id, message); | 
|  2101   } |  1991   } | 
|  2102 } |  1992 } | 
|  2103  |  1993  | 
|  2104 void RenderViewHost::OnAccessibilityNotifications( |  1994 void RenderViewHost::OnAccessibilityNotifications( | 
|  2105     const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |  1995     const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2290   if (printer_query.get()) { |  2180   if (printer_query.get()) { | 
|  2291     BrowserThread::PostTask( |  2181     BrowserThread::PostTask( | 
|  2292         BrowserThread::IO, FROM_HERE, |  2182         BrowserThread::IO, FROM_HERE, | 
|  2293         NewRunnableMethod(printer_query.get(), |  2183         NewRunnableMethod(printer_query.get(), | 
|  2294                           &printing::PrinterQuery::StopWorker)); |  2184                           &printing::PrinterQuery::StopWorker)); | 
|  2295   } |  2185   } | 
|  2296  |  2186  | 
|  2297   // Send the printingDone msg for now. |  2187   // Send the printingDone msg for now. | 
|  2298   Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true)); |  2188   Send(new ViewMsg_PrintingDone(routing_id(), params.document_cookie, true)); | 
|  2299 } |  2189 } | 
| OLD | NEW |