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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (renderer_process_handle == NULL) | 146 if (renderer_process_handle == NULL) |
147 renderer_process_handle = GetCurrentProcess(); | 147 renderer_process_handle = GetCurrentProcess(); |
148 | 148 |
149 BOOL result = DuplicateHandle(GetCurrentProcess(), | 149 BOOL result = DuplicateHandle(GetCurrentProcess(), |
150 modal_dialog_event_->handle(), | 150 modal_dialog_event_->handle(), |
151 renderer_process_handle, | 151 renderer_process_handle, |
152 &modal_dialog_event_handle, | 152 &modal_dialog_event_handle, |
153 SYNCHRONIZE, | 153 SYNCHRONIZE, |
154 FALSE, | 154 FALSE, |
155 0); | 155 0); |
156 DCHECK(result) << "Couldn't duplicate the modal dialog handle for the renderer
."; | 156 DCHECK(result) << |
| 157 "Couldn't duplicate the modal dialog handle for the renderer."; |
157 #endif | 158 #endif |
158 | 159 |
159 DCHECK(view()); | 160 DCHECK(view()); |
160 | 161 |
161 ModalDialogEvent modal_dialog_event; | 162 ModalDialogEvent modal_dialog_event; |
162 #if defined(OS_WIN) | 163 #if defined(OS_WIN) |
163 modal_dialog_event.event = modal_dialog_event_handle; | 164 modal_dialog_event.event = modal_dialog_event_handle; |
164 #endif | 165 #endif |
165 | 166 |
166 Send(new ViewMsg_New(gfx::IdFromNativeView(view()->GetPluginNativeView()), | 167 Send(new ViewMsg_New(gfx::IdFromNativeView(view()->GetPluginNativeView()), |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 new_request_id)); | 305 new_request_id)); |
305 } else { | 306 } else { |
306 // This RenderViewHost doesn't have a live renderer, so just skip closing | 307 // This RenderViewHost doesn't have a live renderer, so just skip closing |
307 // the page. We must notify the ResourceDispatcherHost on the IO thread, | 308 // the page. We must notify the ResourceDispatcherHost on the IO thread, |
308 // which we will do through the RenderProcessHost's widget helper. | 309 // which we will do through the RenderProcessHost's widget helper. |
309 process()->CrossSiteClosePageACK(new_render_process_host_id, | 310 process()->CrossSiteClosePageACK(new_render_process_host_id, |
310 new_request_id); | 311 new_request_id); |
311 } | 312 } |
312 } | 313 } |
313 | 314 |
314 void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request, | 315 void RenderViewHost::SetHasPendingCrossSiteRequest(bool has_pending_request, |
315 int request_id) { | 316 int request_id) { |
316 Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest( | 317 Singleton<CrossSiteRequestManager>()->SetHasPendingCrossSiteRequest( |
317 process()->host_id(), routing_id(), has_pending_request); | 318 process()->host_id(), routing_id(), has_pending_request); |
318 pending_request_id_ = request_id; | 319 pending_request_id_ = request_id; |
319 } | 320 } |
320 | 321 |
321 int RenderViewHost::GetPendingRequestId() { | 322 int RenderViewHost::GetPendingRequestId() { |
322 return pending_request_id_; | 323 return pending_request_id_; |
323 } | 324 } |
324 | 325 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 void RenderViewHost::FillPasswordForm( | 379 void RenderViewHost::FillPasswordForm( |
379 const PasswordFormDomManager::FillData& form_data) { | 380 const PasswordFormDomManager::FillData& form_data) { |
380 Send(new ViewMsg_FillPasswordForm(routing_id(), form_data)); | 381 Send(new ViewMsg_FillPasswordForm(routing_id(), form_data)); |
381 } | 382 } |
382 | 383 |
383 void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data, | 384 void RenderViewHost::DragTargetDragEnter(const WebDropData& drop_data, |
384 const gfx::Point& client_pt, const gfx::Point& screen_pt) { | 385 const gfx::Point& client_pt, const gfx::Point& screen_pt) { |
385 // Grant the renderer the ability to load the drop_data. | 386 // Grant the renderer the ability to load the drop_data. |
386 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); | 387 RendererSecurityPolicy* policy = RendererSecurityPolicy::GetInstance(); |
387 policy->GrantRequestURL(process()->host_id(), drop_data.url); | 388 policy->GrantRequestURL(process()->host_id(), drop_data.url); |
388 for (std::vector<std::wstring>::const_iterator iter(drop_data.filenames.begin(
)); | 389 for (std::vector<std::wstring>::const_iterator |
| 390 iter(drop_data.filenames.begin()); |
389 iter != drop_data.filenames.end(); ++iter) { | 391 iter != drop_data.filenames.end(); ++iter) { |
390 policy->GrantRequestURL(process()->host_id(), | 392 policy->GrantRequestURL(process()->host_id(), |
391 net::FilePathToFileURL(*iter)); | 393 net::FilePathToFileURL(*iter)); |
392 policy->GrantUploadFile(process()->host_id(), *iter); | 394 policy->GrantUploadFile(process()->host_id(), *iter); |
393 } | 395 } |
394 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, | 396 Send(new ViewMsg_DragTargetDragEnter(routing_id(), drop_data, client_pt, |
395 screen_pt)); | 397 screen_pt)); |
396 } | 398 } |
397 | 399 |
398 void RenderViewHost::DragTargetDragOver( | 400 void RenderViewHost::DragTargetDragOver( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 if (are_javascript_messages_suppressed_) { | 513 if (are_javascript_messages_suppressed_) { |
512 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_); | 514 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_); |
513 return; | 515 return; |
514 } | 516 } |
515 | 517 |
516 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 518 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
517 } | 519 } |
518 | 520 |
519 if (--modal_dialog_count_ == 0) | 521 if (--modal_dialog_count_ == 0) |
520 modal_dialog_event_->Reset(); | 522 modal_dialog_event_->Reset(); |
521 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, prompt)
; | 523 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, |
| 524 success, prompt); |
522 Send(reply_msg); | 525 Send(reply_msg); |
523 } | 526 } |
524 | 527 |
525 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, | 528 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, |
526 const std::string& json_retval) { | 529 const std::string& json_retval) { |
527 if (is_waiting_for_unload_ack_) | 530 if (is_waiting_for_unload_ack_) |
528 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); | 531 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); |
529 | 532 |
530 if (--modal_dialog_count_ == 0) | 533 if (--modal_dialog_count_ == 0) |
531 modal_dialog_event_->Reset(); | 534 modal_dialog_event_->Reset(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 } | 571 } |
569 | 572 |
570 void RenderViewHost::AllowDomAutomationBindings() { | 573 void RenderViewHost::AllowDomAutomationBindings() { |
571 // Expose the binding that allows the DOM to send messages here. | 574 // Expose the binding that allows the DOM to send messages here. |
572 Send(new ViewMsg_AllowDomAutomationBindings(routing_id(), true)); | 575 Send(new ViewMsg_AllowDomAutomationBindings(routing_id(), true)); |
573 } | 576 } |
574 | 577 |
575 void RenderViewHost::AllowDOMUIBindings() { | 578 void RenderViewHost::AllowDOMUIBindings() { |
576 DCHECK(!renderer_initialized_); | 579 DCHECK(!renderer_initialized_); |
577 enable_dom_ui_bindings_ = true; | 580 enable_dom_ui_bindings_ = true; |
578 RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings(process()->host_id()
); | 581 RendererSecurityPolicy::GetInstance()->GrantDOMUIBindings( |
| 582 process()->host_id()); |
579 } | 583 } |
580 | 584 |
581 void RenderViewHost::AllowExternalHostBindings() { | 585 void RenderViewHost::AllowExternalHostBindings() { |
582 enable_external_host_bindings_ = true; | 586 enable_external_host_bindings_ = true; |
583 } | 587 } |
584 | 588 |
585 void RenderViewHost::SetDOMUIProperty(const std::string& name, | 589 void RenderViewHost::SetDOMUIProperty(const std::string& name, |
586 const std::string& value) { | 590 const std::string& value) { |
587 DCHECK(enable_dom_ui_bindings_); | 591 DCHECK(enable_dom_ui_bindings_); |
588 Send(new ViewMsg_SetDOMUIProperty(routing_id(), name, value)); | 592 Send(new ViewMsg_SetDOMUIProperty(routing_id(), name, value)); |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 const std::string& security_info) { | 936 const std::string& security_info) { |
933 delegate_->DidLoadResourceFromMemoryCache(url, security_info); | 937 delegate_->DidLoadResourceFromMemoryCache(url, security_info); |
934 } | 938 } |
935 | 939 |
936 void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame, | 940 void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(bool is_main_frame, |
937 const GURL& url) { | 941 const GURL& url) { |
938 GURL validated_url(url); | 942 GURL validated_url(url); |
939 FilterURL(RendererSecurityPolicy::GetInstance(), | 943 FilterURL(RendererSecurityPolicy::GetInstance(), |
940 process()->host_id(), &validated_url); | 944 process()->host_id(), &validated_url); |
941 | 945 |
942 delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame, validated_url)
; | 946 delegate_->DidStartProvisionalLoadForFrame(this, is_main_frame, |
| 947 validated_url); |
943 } | 948 } |
944 | 949 |
945 void RenderViewHost::OnMsgDidFailProvisionalLoadWithError( | 950 void RenderViewHost::OnMsgDidFailProvisionalLoadWithError( |
946 bool is_main_frame, | 951 bool is_main_frame, |
947 int error_code, | 952 int error_code, |
948 const GURL& url, | 953 const GURL& url, |
949 bool showing_repost_interstitial) { | 954 bool showing_repost_interstitial) { |
950 GURL validated_url(url); | 955 GURL validated_url(url); |
951 FilterURL(RendererSecurityPolicy::GetInstance(), | 956 FilterURL(RendererSecurityPolicy::GetInstance(), |
952 process()->host_id(), &validated_url); | 957 process()->host_id(), &validated_url); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 // stopped at a breakpoint. | 1274 // stopped at a breakpoint. |
1270 if (!debugger_attached_) { | 1275 if (!debugger_attached_) { |
1271 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_); | 1276 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_); |
1272 } | 1277 } |
1273 } | 1278 } |
1274 | 1279 |
1275 void RenderViewHost::NotifyRendererResponsive() { | 1280 void RenderViewHost::NotifyRendererResponsive() { |
1276 delegate_->RendererResponsive(this); | 1281 delegate_->RendererResponsive(this); |
1277 } | 1282 } |
1278 | 1283 |
| 1284 gfx::Rect RenderViewHost::GetRootWindowResizerRect() const { |
| 1285 return delegate_->GetRootWindowResizerRect(); |
| 1286 } |
| 1287 |
1279 void RenderViewHost::OnDebugDisconnect() { | 1288 void RenderViewHost::OnDebugDisconnect() { |
1280 if (debugger_attached_) { | 1289 if (debugger_attached_) { |
1281 debugger_attached_ = false; | 1290 debugger_attached_ = false; |
1282 g_browser_process->debugger_wrapper()->OnDebugDisconnect(); | 1291 g_browser_process->debugger_wrapper()->OnDebugDisconnect(); |
1283 } | 1292 } |
1284 } | 1293 } |
1285 | 1294 |
1286 #ifdef CHROME_PERSONALIZATION | 1295 #ifdef CHROME_PERSONALIZATION |
1287 void RenderViewHost::RaisePersonalizationEvent(std::string event_name, | 1296 void RenderViewHost::RaisePersonalizationEvent(std::string event_name, |
1288 std::string event_arg) { | 1297 std::string event_arg) { |
1289 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); | 1298 Send(new ViewMsg_PersonalizationEvent(routing_id(), event_name, event_arg)); |
1290 } | 1299 } |
1291 #endif | 1300 #endif |
1292 | 1301 |
1293 void RenderViewHost::ForwardMessageFromExternalHost( | 1302 void RenderViewHost::ForwardMessageFromExternalHost( |
1294 const std::string& target, const std::string& message) { | 1303 const std::string& target, const std::string& message) { |
1295 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, | 1304 Send(new ViewMsg_HandleMessageFromExternalHost(routing_id(), target, |
1296 message)); | 1305 message)); |
1297 } | 1306 } |
OLD | NEW |