| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/waitable_event.h" | 12 #include "base/waitable_event.h" |
| 13 #include "chrome/app/result_codes.h" | 13 #include "chrome/app/result_codes.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/cross_site_request_manager.h" | 15 #include "chrome/browser/cross_site_request_manager.h" |
| 16 #include "chrome/browser/profile.h" | 16 #include "chrome/browser/profile.h" |
| 17 #include "chrome/browser/metrics/user_metrics.h" | 17 #include "chrome/browser/metrics/user_metrics.h" |
| 18 #include "chrome/browser/renderer_host/renderer_security_policy.h" | 18 #include "chrome/browser/renderer_host/renderer_security_policy.h" |
| 19 #include "chrome/browser/renderer_host/render_process_host.h" | 19 #include "chrome/browser/renderer_host/render_process_host.h" |
| 20 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 20 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 21 #include "chrome/browser/renderer_host/render_widget_host.h" | 21 #include "chrome/browser/renderer_host/render_widget_host.h" |
| 22 #include "chrome/browser/tab_contents/navigation_entry.h" | 22 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 23 #include "chrome/browser/tab_contents/site_instance.h" | 23 #include "chrome/browser/tab_contents/site_instance.h" |
| 24 #include "chrome/browser/tab_contents/web_contents.h" | 24 #include "chrome/browser/tab_contents/web_contents.h" |
| 25 #include "chrome/common/render_messages.h" |
| 25 #include "chrome/common/resource_bundle.h" | 26 #include "chrome/common/resource_bundle.h" |
| 26 #include "chrome/common/thumbnail_score.h" | 27 #include "chrome/common/thumbnail_score.h" |
| 27 #include "net/base/net_util.h" | 28 #include "net/base/net_util.h" |
| 28 #include "skia/include/SkBitmap.h" | 29 #include "skia/include/SkBitmap.h" |
| 29 #include "webkit/glue/autofill_form.h" | 30 #include "webkit/glue/autofill_form.h" |
| 30 | 31 |
| 31 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 32 // TODO(port): remove these when stubs are filled in | 33 // TODO(port): remove these when stubs are filled in |
| 33 #include "chrome/browser/debugger/debugger_wrapper.h" | 34 #include "chrome/browser/debugger/debugger_wrapper.h" |
| 34 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 35 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 664 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
| 664 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 665 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
| 665 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) | 666 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnMsgRunModal) |
| 666 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererReady, OnMsgRendererReady) | 667 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererReady, OnMsgRendererReady) |
| 667 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererGone, OnMsgRendererGone) | 668 IPC_MESSAGE_HANDLER(ViewHostMsg_RendererGone, OnMsgRendererGone) |
| 668 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) | 669 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_FrameNavigate, OnMsgNavigate(msg)) |
| 669 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) | 670 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnMsgUpdateState) |
| 670 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) | 671 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTitle, OnMsgUpdateTitle) |
| 671 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) | 672 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateEncoding, OnMsgUpdateEncoding) |
| 672 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) | 673 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnMsgUpdateTargetURL) |
| 673 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_Thumbnail, OnMsgThumbnail(msg)) | 674 IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail) |
| 674 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 675 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
| 675 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 676 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
| 676 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) | 677 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading) |
| 677 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) | 678 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnMsgDidStopLoading) |
| 678 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 679 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
| 679 OnMsgDidLoadResourceFromMemoryCache) | 680 OnMsgDidLoadResourceFromMemoryCache) |
| 680 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad, | 681 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad, |
| 681 OnMsgDidRedirectProvisionalLoad) | 682 OnMsgDidRedirectProvisionalLoad) |
| 682 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, | 683 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame, |
| 683 OnMsgDidStartProvisionalLoadForFrame) | 684 OnMsgDidStartProvisionalLoadForFrame) |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 | 885 |
| 885 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, | 886 void RenderViewHost::OnMsgUpdateTargetURL(int32 page_id, |
| 886 const GURL& url) { | 887 const GURL& url) { |
| 887 delegate_->UpdateTargetURL(page_id, url); | 888 delegate_->UpdateTargetURL(page_id, url); |
| 888 | 889 |
| 889 // Send a notification back to the renderer that we are ready to | 890 // Send a notification back to the renderer that we are ready to |
| 890 // receive more target urls. | 891 // receive more target urls. |
| 891 Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); | 892 Send(new ViewMsg_UpdateTargetURL_ACK(routing_id())); |
| 892 } | 893 } |
| 893 | 894 |
| 894 void RenderViewHost::OnMsgThumbnail(const IPC::Message& msg) { | 895 void RenderViewHost::OnMsgThumbnail(const GURL& url, |
| 895 // crack the message | 896 const ThumbnailScore& score, |
| 896 void* iter = NULL; | 897 const SkBitmap& bitmap) { |
| 897 GURL url; | |
| 898 if (!IPC::ParamTraits<GURL>::Read(&msg, &iter, &url)) | |
| 899 return; | |
| 900 | |
| 901 ThumbnailScore score; | |
| 902 if (!IPC::ParamTraits<ThumbnailScore>::Read(&msg, &iter, &score)) | |
| 903 return; | |
| 904 | |
| 905 // thumbnail data | |
| 906 SkBitmap bitmap; | |
| 907 if (!IPC::ParamTraits<SkBitmap>::Read(&msg, &iter, &bitmap)) | |
| 908 return; | |
| 909 | |
| 910 delegate_->UpdateThumbnail(url, bitmap, score); | 898 delegate_->UpdateThumbnail(url, bitmap, score); |
| 911 } | 899 } |
| 912 | 900 |
| 913 void RenderViewHost::OnMsgClose() { | 901 void RenderViewHost::OnMsgClose() { |
| 914 delegate_->Close(this); | 902 delegate_->Close(this); |
| 915 } | 903 } |
| 916 | 904 |
| 917 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { | 905 void RenderViewHost::OnMsgRequestMove(const gfx::Rect& pos) { |
| 918 delegate_->RequestMove(pos); | 906 delegate_->RequestMove(pos); |
| 919 } | 907 } |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 std::string event_arg) { | 1286 std::string event_arg) { |
| 1299 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); | 1287 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); |
| 1300 } | 1288 } |
| 1301 #endif | 1289 #endif |
| 1302 | 1290 |
| 1303 void RenderViewHost::ForwardMessageFromExternalHost( | 1291 void RenderViewHost::ForwardMessageFromExternalHost( |
| 1304 const std::string& target, const std::string& message) { | 1292 const std::string& target, const std::string& message) { |
| 1305 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, | 1293 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, |
| 1306 message)); | 1294 message)); |
| 1307 } | 1295 } |
| OLD | NEW |