OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 657 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
658 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 658 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
659 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) | 659 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) |
660 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererReady, OnMsgRendererReady) | 660 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererReady, OnMsgRendererReady) |
661 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererGone, OnMsgRendererGone) | 661 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererGone, OnMsgRendererGone) |
662 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) | 662 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) |
663 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) | 663 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) |
664 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) | 664 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) |
665 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) | 665 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) |
666 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) | 666 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) |
667 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_Thumbnail, OnMsgThumbnail(msg)) | 667 IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail) |
668 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 668 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
669 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 669 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
670 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) | 670 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) |
671 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) | 671 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) |
672 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 672 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
673 OnMsgDidLoadResourceFromMemoryCache) | 673 OnMsgDidLoadResourceFromMemoryCache) |
674 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad, | 674 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad, |
675 OnMsgDidRedirectProvisionalLoad) | 675 OnMsgDidRedirectProvisionalLoad) |
676 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, | 676 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, |
677 OnMsgDidStartProvisionalLoadForFrame) | 677 OnMsgDidStartProvisionalLoadForFrame) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 // Subframes are identified by the page transition type. For subframes loaded | 827 // Subframes are identified by the page transition type. For subframes loaded |
828 // as part of a wider page load, the page_id will be the same as for the top | 828 // as part of a wider page load, the page_id will be the same as for the top |
829 // level frame. If the user explicitly requests a subframe navigation, we will | 829 // level frame. If the user explicitly requests a subframe navigation, we will |
830 // get a new page_id because we need to create a new navigation entry for that | 830 // get a new page_id because we need to create a new navigation entry for that |
831 // action. | 831 // action. |
832 void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) { | 832 void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) { |
833 // Read the parameters out of the IPC message directly to avoid making another | 833 // Read the parameters out of the IPC message directly to avoid making another |
834 // copy when we filter the URLs. | 834 // copy when we filter the URLs. |
835 void* iter = NULL; | 835 void* iter = NULL; |
836 ViewHostMsg_FrameNavigate_Params validated_params; | 836 ViewHostMsg_FrameNavigate_Params validated_params; |
837 if (!IPC::ParamTraits<ViewHostMsg_FrameNavigate_Params>:: | 837 if (!ParamTraits<ViewHostMsg_FrameNavigate_Params>:: |
838 Read(&msg, &iter, &validated_params)) | 838 Read(&msg, &iter, &validated_params)) |
839 return; | 839 return; |
840 | 840 |
841 const int renderer_id = process()->host_id(); | 841 const int renderer_id = process()->host_id(); |
842 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); | 842 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); |
843 // Without this check, an evil renderer can trick the browser into creating | 843 // Without this check, an evil renderer can trick the browser into creating |
844 // a navigation entry for a banned URL. If the user clicks the back button | 844 // a navigation entry for a banned URL. If the user clicks the back button |
845 // followed by the forward button (or clicks reload, or round-trips through | 845 // followed by the forward button (or clicks reload, or round-trips through |
846 // session restore, etc), we'll think that the browser commanded the | 846 // session restore, etc), we'll think that the browser commanded the |
847 // renderer to load the URL and grant the renderer the privileges to request | 847 // renderer to load the URL and grant the renderer the privileges to request |
(...skipping 30 matching lines...) Expand all Loading... |
878 | 878 |
879 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, | 879 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, |
880 const GURL& url) { | 880 const GURL& url) { |
881 delegate_->UpdateTargetURL(page_id, url); | 881 delegate_->UpdateTargetURL(page_id, url); |
882 | 882 |
883 // Send a notification back to the renderer that we are ready to | 883 // Send a notification back to the renderer that we are ready to |
884 // receive more target urls. | 884 // receive more target urls. |
885 Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); | 885 Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); |
886 } | 886 } |
887 | 887 |
888 void RenderViewHost::OnMsgThumbnail(const IPC::Message& msg) { | 888 void RenderViewHost::OnMsgThumbnail(const GURL& url, |
889 // crack the message | 889 const ThumbnailScore& score, |
890 void* iter = NULL; | 890 const SkBitmap& bitmap) { |
891 GURL url; | |
892 if (!IPC::ParamTraits<GURL>::Read(&msg, &iter, &url)) | |
893 return; | |
894 | |
895 ThumbnailScore score; | |
896 if (!IPC::ParamTraits<ThumbnailScore>::Read(&msg, &iter, &score)) | |
897 return; | |
898 | |
899 // thumbnail data | |
900 SkBitmap bitmap; | |
901 if (!IPC::ParamTraits<SkBitmap>::Read(&msg, &iter, &bitmap)) | |
902 return; | |
903 | |
904 delegate_->UpdateThumbnail(url, bitmap, score); | 891 delegate_->UpdateThumbnail(url, bitmap, score); |
905 } | 892 } |
906 | 893 |
907 void RenderViewHost::OnMsgClose() { | 894 void RenderViewHost::OnMsgClose() { |
908 delegate_->Close(this); | 895 delegate_->Close(this); |
909 } | 896 } |
910 | 897 |
911 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { | 898 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { |
912 delegate_->RequestMove(pos); | 899 delegate_->RequestMove(pos); |
913 } | 900 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 std::string event_arg) { | 1280 std::string event_arg) { |
1294 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); | 1281 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); |
1295 } | 1282 } |
1296 #endif | 1283 #endif |
1297 | 1284 |
1298 void RenderViewHost::ForwardMessageFromExternalHost( | 1285 void RenderViewHost::ForwardMessageFromExternalHost( |
1299 const std::string& target, const std::string& message) { | 1286 const std::string& target, const std::string& message) { |
1300 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, | 1287 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, |
1301 message)); | 1288 message)); |
1302 } | 1289 } |
OLD | NEW |