| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_view_host.h" | 5 #include "content/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 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 | 474 |
| 475 int RenderViewHost::ExecuteJavascriptInWebFrameNotifyResult( | 475 int RenderViewHost::ExecuteJavascriptInWebFrameNotifyResult( |
| 476 const string16& frame_xpath, | 476 const string16& frame_xpath, |
| 477 const string16& jscript) { | 477 const string16& jscript) { |
| 478 static int next_id = 1; | 478 static int next_id = 1; |
| 479 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, | 479 Send(new ViewMsg_ScriptEvalRequest(routing_id(), frame_xpath, jscript, |
| 480 next_id, true)); | 480 next_id, true)); |
| 481 return next_id++; | 481 return next_id++; |
| 482 } | 482 } |
| 483 | 483 |
| 484 void RenderViewHost::Undo() { | |
| 485 Send(new ViewMsg_Undo(routing_id())); | |
| 486 UserMetrics::RecordAction(UserMetricsAction("Undo")); | |
| 487 } | |
| 488 | |
| 489 void RenderViewHost::Redo() { | |
| 490 Send(new ViewMsg_Redo(routing_id())); | |
| 491 UserMetrics::RecordAction(UserMetricsAction("Redo")); | |
| 492 } | |
| 493 | |
| 494 void RenderViewHost::Cut() { | |
| 495 Send(new ViewMsg_Cut(routing_id())); | |
| 496 UserMetrics::RecordAction(UserMetricsAction("Cut")); | |
| 497 } | |
| 498 | |
| 499 void RenderViewHost::Copy() { | |
| 500 Send(new ViewMsg_Copy(routing_id())); | |
| 501 UserMetrics::RecordAction(UserMetricsAction("Copy")); | |
| 502 } | |
| 503 | |
| 504 void RenderViewHost::CopyToFindPboard() { | |
| 505 #if defined(OS_MACOSX) | |
| 506 // Windows/Linux don't have the concept of a find pasteboard. | |
| 507 Send(new ViewMsg_CopyToFindPboard(routing_id())); | |
| 508 UserMetrics::RecordAction(UserMetricsAction("CopyToFindPboard")); | |
| 509 #endif | |
| 510 } | |
| 511 | |
| 512 void RenderViewHost::Paste() { | |
| 513 Send(new ViewMsg_Paste(routing_id())); | |
| 514 UserMetrics::RecordAction(UserMetricsAction("Paste")); | |
| 515 } | |
| 516 | |
| 517 void RenderViewHost::Delete() { | |
| 518 Send(new ViewMsg_Delete(routing_id())); | |
| 519 UserMetrics::RecordAction(UserMetricsAction("DeleteSelection")); | |
| 520 } | |
| 521 | |
| 522 void RenderViewHost::SelectAll() { | |
| 523 Send(new ViewMsg_SelectAll(routing_id())); | |
| 524 UserMetrics::RecordAction(UserMetricsAction("SelectAll")); | |
| 525 } | |
| 526 | |
| 527 void RenderViewHost::JavaScriptDialogClosed(IPC::Message* reply_msg, | 484 void RenderViewHost::JavaScriptDialogClosed(IPC::Message* reply_msg, |
| 528 bool success, | 485 bool success, |
| 529 const string16& user_input) { | 486 const string16& user_input) { |
| 530 process()->set_ignore_input_events(false); | 487 process()->set_ignore_input_events(false); |
| 531 bool is_waiting = | 488 bool is_waiting = |
| 532 is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; | 489 is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; |
| 533 if (is_waiting) | 490 if (is_waiting) |
| 534 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 491 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
| 535 | 492 |
| 536 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 493 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 | 1211 |
| 1255 if (!policy->CanRequestURL(renderer_id, *url)) { | 1212 if (!policy->CanRequestURL(renderer_id, *url)) { |
| 1256 // If this renderer is not permitted to request this URL, we invalidate the | 1213 // If this renderer is not permitted to request this URL, we invalidate the |
| 1257 // URL. This prevents us from storing the blocked URL and becoming confused | 1214 // URL. This prevents us from storing the blocked URL and becoming confused |
| 1258 // later. | 1215 // later. |
| 1259 VLOG(1) << "Blocked URL " << url->spec(); | 1216 VLOG(1) << "Blocked URL " << url->spec(); |
| 1260 *url = GURL(); | 1217 *url = GURL(); |
| 1261 } | 1218 } |
| 1262 } | 1219 } |
| 1263 | 1220 |
| 1221 void RenderViewHost::SetAltErrorPageURL(const GURL& url) { |
| 1222 Send(new ViewMsg_SetAltErrorPageURL(routing_id(), url)); |
| 1223 } |
| 1224 |
| 1225 void RenderViewHost::ExitFullscreen() { |
| 1226 Send(new ViewMsg_ExitFullscreen(routing_id())); |
| 1227 } |
| 1228 |
| 1229 void RenderViewHost::UpdateWebkitPreferences(const WebPreferences& prefs) { |
| 1230 Send(new ViewMsg_UpdateWebPreferences(routing_id(), prefs)); |
| 1231 } |
| 1232 |
| 1233 void RenderViewHost::ClearFocusedNode() { |
| 1234 Send(new ViewMsg_ClearFocusedNode(routing_id())); |
| 1235 } |
| 1236 |
| 1264 void RenderViewHost::OnAccessibilityNotifications( | 1237 void RenderViewHost::OnAccessibilityNotifications( |
| 1265 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { | 1238 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params) { |
| 1266 if (view() && !is_swapped_out_) | 1239 if (view() && !is_swapped_out_) |
| 1267 view()->OnAccessibilityNotifications(params); | 1240 view()->OnAccessibilityNotifications(params); |
| 1268 | 1241 |
| 1269 if (!params.empty()) { | 1242 if (!params.empty()) { |
| 1270 for (unsigned i = 0; i < params.size(); i++) { | 1243 for (unsigned i = 0; i < params.size(); i++) { |
| 1271 const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; | 1244 const ViewHostMsg_AccessibilityNotification_Params& param = params[i]; |
| 1272 | 1245 |
| 1273 if (param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE && | 1246 if (param.notification_type == ViewHostMsg_AccEvent::LOAD_COMPLETE && |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 const ViewHostMsg_RunFileChooser_Params& params) { | 1342 const ViewHostMsg_RunFileChooser_Params& params) { |
| 1370 delegate_->RunFileChooser(this, params); | 1343 delegate_->RunFileChooser(this, params); |
| 1371 } | 1344 } |
| 1372 | 1345 |
| 1373 void RenderViewHost::OnWebUISend(const GURL& source_url, | 1346 void RenderViewHost::OnWebUISend(const GURL& source_url, |
| 1374 const std::string& name, | 1347 const std::string& name, |
| 1375 const base::ListValue& args) { | 1348 const base::ListValue& args) { |
| 1376 delegate_->WebUISend(this, source_url, name, args); | 1349 delegate_->WebUISend(this, source_url, name, args); |
| 1377 } | 1350 } |
| 1378 | 1351 |
| OLD | NEW |