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

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

Issue 7650: Move more platform-specific stuff from WebContents to the view.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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) 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/render_view_host.h" 5 #include "chrome/browser/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 void RenderViewHost::OnMsgDidDownloadImage( 947 void RenderViewHost::OnMsgDidDownloadImage(
948 int id, 948 int id,
949 const GURL& image_url, 949 const GURL& image_url,
950 bool errored, 950 bool errored,
951 const SkBitmap& image) { 951 const SkBitmap& image) {
952 delegate_->DidDownloadImage(this, id, image_url, errored, image); 952 delegate_->DidDownloadImage(this, id, image_url, errored, image);
953 } 953 }
954 954
955 void RenderViewHost::OnMsgContextMenu( 955 void RenderViewHost::OnMsgContextMenu(
956 const ViewHostMsg_ContextMenu_Params& params) { 956 const ViewHostMsg_ContextMenu_Params& params) {
957 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
958 if (!view)
959 return;
960
957 // Validate the URLs in |params|. If the renderer can't request the URLs 961 // Validate the URLs in |params|. If the renderer can't request the URLs
958 // directly, don't show them in the context menu. 962 // directly, don't show them in the context menu.
959 ViewHostMsg_ContextMenu_Params validated_params(params); 963 ViewHostMsg_ContextMenu_Params validated_params(params);
960 const int renderer_id = process()->host_id(); 964 const int renderer_id = process()->host_id();
961 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); 965 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance();
962 966
963 FilterURL(policy, renderer_id, &validated_params.link_url); 967 FilterURL(policy, renderer_id, &validated_params.link_url);
964 FilterURL(policy, renderer_id, &validated_params.image_url); 968 FilterURL(policy, renderer_id, &validated_params.image_url);
965 FilterURL(policy, renderer_id, &validated_params.page_url); 969 FilterURL(policy, renderer_id, &validated_params.page_url);
966 FilterURL(policy, renderer_id, &validated_params.frame_url); 970 FilterURL(policy, renderer_id, &validated_params.frame_url);
967 971
968 delegate_->ShowContextMenu(validated_params); 972 view->ShowContextMenu(validated_params);
969 } 973 }
970 974
971 void RenderViewHost::OnMsgOpenURL(const GURL& url, 975 void RenderViewHost::OnMsgOpenURL(const GURL& url,
972 WindowOpenDisposition disposition) { 976 WindowOpenDisposition disposition) {
973 GURL validated_url(url); 977 GURL validated_url(url);
974 FilterURL(RendererSecurityPolicy::GetInstance(), 978 FilterURL(RendererSecurityPolicy::GetInstance(),
975 process()->host_id(), &validated_url); 979 process()->host_id(), &validated_url);
976 980
977 delegate_->RequestOpenURL(validated_url, disposition); 981 delegate_->RequestOpenURL(validated_url, disposition);
978 } 982 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg); 1051 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg);
1048 } 1052 }
1049 1053
1050 void RenderViewHost::OnMsgPasswordFormsSeen( 1054 void RenderViewHost::OnMsgPasswordFormsSeen(
1051 const std::vector<PasswordForm>& forms) { 1055 const std::vector<PasswordForm>& forms) {
1052 delegate_->PasswordFormsSeen(forms); 1056 delegate_->PasswordFormsSeen(forms);
1053 } 1057 }
1054 1058
1055 void RenderViewHost::OnMsgStartDragging( 1059 void RenderViewHost::OnMsgStartDragging(
1056 const WebDropData& drop_data) { 1060 const WebDropData& drop_data) {
1057 delegate_->StartDragging(drop_data); 1061 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1062 if (view)
1063 view->StartDragging(drop_data);
1058 } 1064 }
1059 1065
1060 void RenderViewHost::OnUpdateDragCursor(bool is_drop_target) { 1066 void RenderViewHost::OnUpdateDragCursor(bool is_drop_target) {
1061 delegate_->UpdateDragCursor(is_drop_target); 1067 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1068 if (view)
1069 view->UpdateDragCursor(is_drop_target);
1062 } 1070 }
1063 1071
1064 void RenderViewHost::OnTakeFocus(bool reverse) { 1072 void RenderViewHost::OnTakeFocus(bool reverse) {
1065 delegate_->TakeFocus(reverse); 1073 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1074 if (view)
1075 view->TakeFocus(reverse);
1066 } 1076 }
1067 1077
1068 void RenderViewHost::OnMsgPageHasOSDD(int32 page_id, const GURL& doc_url, 1078 void RenderViewHost::OnMsgPageHasOSDD(int32 page_id, const GURL& doc_url,
1069 bool autodetected) { 1079 bool autodetected) {
1070 delegate_->PageHasOSDD(this, page_id, doc_url, autodetected); 1080 delegate_->PageHasOSDD(this, page_id, doc_url, autodetected);
1071 } 1081 }
1072 1082
1073 void RenderViewHost::OnMsgInspectElementReply(int num_resources) { 1083 void RenderViewHost::OnMsgInspectElementReply(int num_resources) {
1074 delegate_->InspectElementReply(num_resources); 1084 delegate_->InspectElementReply(num_resources);
1075 } 1085 }
(...skipping 23 matching lines...) Expand all
1099 debugger_attached_ = true; 1109 debugger_attached_ = true;
1100 g_browser_process->debugger_wrapper()->OnDebugAttach(); 1110 g_browser_process->debugger_wrapper()->OnDebugAttach();
1101 } 1111 }
1102 } 1112 }
1103 1113
1104 void RenderViewHost::OnUserMetricsRecordAction(const std::wstring& action) { 1114 void RenderViewHost::OnUserMetricsRecordAction(const std::wstring& action) {
1105 UserMetrics::RecordComputedAction(action.c_str(), process_->profile()); 1115 UserMetrics::RecordComputedAction(action.c_str(), process_->profile());
1106 } 1116 }
1107 1117
1108 void RenderViewHost::UnhandledInputEvent(const WebInputEvent& event) { 1118 void RenderViewHost::UnhandledInputEvent(const WebInputEvent& event) {
1109 if ((event.type == WebInputEvent::KEY_DOWN) || 1119 RenderViewHostDelegate::View* view = delegate_->GetViewDelegate();
1110 (event.type == WebInputEvent::CHAR)) 1120 if (view) {
1111 delegate_->HandleKeyboardEvent( 1121 // TODO(brettw) why do we have to filter these types of events here. Can't
1112 static_cast<const WebKeyboardEvent&>(event)); 1122 // the renderer just send us the ones we care abount, or maybe the view
1123 // should be able to decide which ones it wants or not?
1124 if ((event.type == WebInputEvent::KEY_DOWN) ||
1125 (event.type == WebInputEvent::CHAR)) {
1126 view->HandleKeyboardEvent(
1127 static_cast<const WebKeyboardEvent&>(event));
1128 }
1129 }
1113 } 1130 }
1114 1131
1115 void RenderViewHost::ForwardKeyboardEvent(const WebKeyboardEvent& key_event) { 1132 void RenderViewHost::ForwardKeyboardEvent(const WebKeyboardEvent& key_event) {
1116 if (key_event.type == WebKeyboardEvent::CHAR && 1133 if (key_event.type == WebKeyboardEvent::CHAR &&
1117 (key_event.key_data == '\n' || key_event.key_data == ' ')) { 1134 (key_event.key_data == '\n' || key_event.key_data == ' ')) {
1118 delegate_->OnEnterOrSpace(); 1135 delegate_->OnEnterOrSpace();
1119 } 1136 }
1120 RenderWidgetHost::ForwardKeyboardEvent(key_event); 1137 RenderWidgetHost::ForwardKeyboardEvent(key_event);
1121 } 1138 }
1122 1139
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 event_name, 1233 event_name,
1217 event_arg)); 1234 event_arg));
1218 } 1235 }
1219 #endif 1236 #endif
1220 1237
1221 void RenderViewHost::ForwardMessageFromExternalHost( 1238 void RenderViewHost::ForwardMessageFromExternalHost(
1222 const std::string& target, const std::string& message) { 1239 const std::string& target, const std::string& message) {
1223 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); 1240 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message));
1224 } 1241 }
1225 1242
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/render_view_host_delegate.h » ('j') | chrome/browser/web_contents.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698