| 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/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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 bool RenderViewHost::PrintPages(const ViewMsg_PrintPages_Params& params) { | 301 bool RenderViewHost::PrintPages(const ViewMsg_PrintPages_Params& params) { |
| 302 return Send(new ViewMsg_PrintPages(routing_id_, params)); | 302 return Send(new ViewMsg_PrintPages(routing_id_, params)); |
| 303 } | 303 } |
| 304 | 304 |
| 305 void RenderViewHost::StartFinding(int request_id, | 305 void RenderViewHost::StartFinding(int request_id, |
| 306 const std::wstring& search_string, | 306 const std::wstring& search_string, |
| 307 bool forward, | 307 bool forward, |
| 308 bool match_case, | 308 bool match_case, |
| 309 bool find_next) { | 309 bool find_next) { |
| 310 if (search_string.empty()) |
| 311 return; |
| 312 |
| 310 FindInPageRequest request; | 313 FindInPageRequest request; |
| 311 request.request_id = request_id; | 314 request.request_id = request_id; |
| 312 request.search_string = search_string; | 315 request.search_string = search_string; |
| 313 request.forward = forward; | 316 request.forward = forward; |
| 314 request.match_case = match_case; | 317 request.match_case = match_case; |
| 315 request.find_next = find_next; | 318 request.find_next = find_next; |
| 316 Send(new ViewMsg_Find(routing_id_, request)); | 319 Send(new ViewMsg_Find(routing_id_, request)); |
| 317 | 320 |
| 318 // This call is asynchronous and returns immediately. | 321 // This call is asynchronous and returns immediately. |
| 319 // The result of the search is sent as a notification message by the renderer. | 322 // The result of the search is sent as a notification message by the renderer. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 369 |
| 367 void RenderViewHost::DragTargetDragLeave() { | 370 void RenderViewHost::DragTargetDragLeave() { |
| 368 Send(new ViewMsg_DragTargetDragLeave(routing_id_)); | 371 Send(new ViewMsg_DragTargetDragLeave(routing_id_)); |
| 369 } | 372 } |
| 370 | 373 |
| 371 void RenderViewHost::DragTargetDrop( | 374 void RenderViewHost::DragTargetDrop( |
| 372 const gfx::Point& client_pt, const gfx::Point& screen_pt) { | 375 const gfx::Point& client_pt, const gfx::Point& screen_pt) { |
| 373 Send(new ViewMsg_DragTargetDrop(routing_id_, client_pt, screen_pt)); | 376 Send(new ViewMsg_DragTargetDrop(routing_id_, client_pt, screen_pt)); |
| 374 } | 377 } |
| 375 | 378 |
| 376 void RenderViewHost::UploadFile(const std::wstring& file_path, | |
| 377 const std::wstring& form, | |
| 378 const std::wstring& file, | |
| 379 const std::wstring& submit, | |
| 380 const std::wstring& other_values) { | |
| 381 if (!process_->channel()) | |
| 382 return; | |
| 383 | |
| 384 RendererSecurityPolicy::GetInstance()->GrantUploadFile(process()->host_id(), | |
| 385 file); | |
| 386 ViewMsg_UploadFile_Params p; | |
| 387 p.file_path = file_path; | |
| 388 p.form = form; | |
| 389 p.file = file; | |
| 390 p.submit = submit; | |
| 391 p.other_values = other_values; | |
| 392 Send(new ViewMsg_UploadFile(routing_id_, p)); | |
| 393 } | |
| 394 | |
| 395 void RenderViewHost::ReservePageIDRange(int size) { | 379 void RenderViewHost::ReservePageIDRange(int size) { |
| 396 Send(new ViewMsg_ReservePageIDRange(routing_id_, size)); | 380 Send(new ViewMsg_ReservePageIDRange(routing_id_, size)); |
| 397 } | 381 } |
| 398 | 382 |
| 399 void RenderViewHost::ExecuteJavascriptInWebFrame( | 383 void RenderViewHost::ExecuteJavascriptInWebFrame( |
| 400 const std::wstring& frame_xpath, const std::wstring& jscript) { | 384 const std::wstring& frame_xpath, const std::wstring& jscript) { |
| 401 Send(new ViewMsg_ScriptEvalRequest(routing_id_, frame_xpath, jscript)); | 385 Send(new ViewMsg_ScriptEvalRequest(routing_id_, frame_xpath, jscript)); |
| 402 } | 386 } |
| 403 | 387 |
| 404 void RenderViewHost::AddMessageToConsole( | 388 void RenderViewHost::AddMessageToConsole( |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( | 1117 void RenderViewHost::GetAllSavableResourceLinksForCurrentPage( |
| 1134 const GURL& page_url) { | 1118 const GURL& page_url) { |
| 1135 Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id_, | 1119 Send(new ViewMsg_GetAllSavableResourceLinksForCurrentPage(routing_id_, |
| 1136 page_url)); | 1120 page_url)); |
| 1137 } | 1121 } |
| 1138 | 1122 |
| 1139 void RenderViewHost::OnReceivedSavableResourceLinksForCurrentPage( | 1123 void RenderViewHost::OnReceivedSavableResourceLinksForCurrentPage( |
| 1140 const std::vector<GURL>& resources_list, | 1124 const std::vector<GURL>& resources_list, |
| 1141 const std::vector<GURL>& referrers_list, | 1125 const std::vector<GURL>& referrers_list, |
| 1142 const std::vector<GURL>& frames_list) { | 1126 const std::vector<GURL>& frames_list) { |
| 1143 delegate_->OnReceivedSavableResourceLinksForCurrentPage(resources_list, | 1127 RenderViewHostDelegate::Save* save_delegate = delegate_->GetSaveDelegate(); |
| 1144 referrers_list, | 1128 if (save_delegate) { |
| 1145 frames_list); | 1129 save_delegate->OnReceivedSavableResourceLinksForCurrentPage( |
| 1130 resources_list, referrers_list, frames_list); |
| 1131 } |
| 1146 } | 1132 } |
| 1147 | 1133 |
| 1148 void RenderViewHost::OnDidGetApplicationInfo( | 1134 void RenderViewHost::OnDidGetApplicationInfo( |
| 1149 int32 page_id, | 1135 int32 page_id, |
| 1150 const webkit_glue::WebApplicationInfo& info) { | 1136 const webkit_glue::WebApplicationInfo& info) { |
| 1151 delegate_->OnDidGetApplicationInfo(page_id, info); | 1137 delegate_->OnDidGetApplicationInfo(page_id, info); |
| 1152 } | 1138 } |
| 1153 | 1139 |
| 1154 void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks( | 1140 void RenderViewHost::GetSerializedHtmlDataForCurrentPageWithLocalLinks( |
| 1155 const std::vector<std::wstring>& links, | 1141 const std::vector<std::wstring>& links, |
| 1156 const std::vector<std::wstring>& local_paths, | 1142 const std::vector<std::wstring>& local_paths, |
| 1157 const std::wstring& local_directory_name) { | 1143 const std::wstring& local_directory_name) { |
| 1158 Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( | 1144 Send(new ViewMsg_GetSerializedHtmlDataForCurrentPageWithLocalLinks( |
| 1159 routing_id_, links, local_paths, local_directory_name)); | 1145 routing_id_, links, local_paths, local_directory_name)); |
| 1160 } | 1146 } |
| 1161 | 1147 |
| 1162 void RenderViewHost::OnReceivedSerializedHtmlData(const GURL& frame_url, | 1148 void RenderViewHost::OnReceivedSerializedHtmlData(const GURL& frame_url, |
| 1163 const std::string& data, | 1149 const std::string& data, |
| 1164 int32 status) { | 1150 int32 status) { |
| 1165 delegate_->OnReceivedSerializedHtmlData(frame_url, data, status); | 1151 RenderViewHostDelegate::Save* save_delegate = delegate_->GetSaveDelegate(); |
| 1152 if (save_delegate) |
| 1153 save_delegate->OnReceivedSerializedHtmlData(frame_url, data, status); |
| 1166 } | 1154 } |
| 1167 | 1155 |
| 1168 void RenderViewHost::OnMsgShouldCloseACK(bool proceed) { | 1156 void RenderViewHost::OnMsgShouldCloseACK(bool proceed) { |
| 1169 StopHangMonitorTimeout(); | 1157 StopHangMonitorTimeout(); |
| 1170 DCHECK(is_waiting_for_unload_ack_); | 1158 DCHECK(is_waiting_for_unload_ack_); |
| 1171 is_waiting_for_unload_ack_ = false; | 1159 is_waiting_for_unload_ack_ = false; |
| 1172 delegate_->ShouldClosePage(proceed); | 1160 delegate_->ShouldClosePage(proceed); |
| 1173 } | 1161 } |
| 1174 | 1162 |
| 1175 void RenderViewHost::OnUnloadListenerChanged(bool has_listener) { | 1163 void RenderViewHost::OnUnloadListenerChanged(bool has_listener) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 event_name, | 1199 event_name, |
| 1212 event_arg)); | 1200 event_arg)); |
| 1213 } | 1201 } |
| 1214 #endif | 1202 #endif |
| 1215 | 1203 |
| 1216 void RenderViewHost::ForwardMessageFromExternalHost( | 1204 void RenderViewHost::ForwardMessageFromExternalHost( |
| 1217 const std::string& target, const std::string& message) { | 1205 const std::string& target, const std::string& message) { |
| 1218 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); | 1206 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id_, target, message)); |
| 1219 } | 1207 } |
| 1220 | 1208 |
| OLD | NEW |