| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 GetContentClient()->browser()->OverrideWebkitPrefs(this, &prefs); | 578 GetContentClient()->browser()->OverrideWebkitPrefs(this, &prefs); |
| 579 return prefs; | 579 return prefs; |
| 580 } | 580 } |
| 581 | 581 |
| 582 void RenderViewHostImpl::ClosePage() { | 582 void RenderViewHostImpl::ClosePage() { |
| 583 is_waiting_for_close_ack_ = true; | 583 is_waiting_for_close_ack_ = true; |
| 584 GetWidget()->StartHangMonitorTimeout( | 584 GetWidget()->StartHangMonitorTimeout( |
| 585 TimeDelta::FromMilliseconds(kUnloadTimeoutMS), | 585 TimeDelta::FromMilliseconds(kUnloadTimeoutMS), |
| 586 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_CLOSE_PAGE); | 586 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_CLOSE_PAGE); |
| 587 | 587 |
| 588 if (IsRenderViewLive()) { | 588 bool is_javascript_dialog_showing = delegate_->IsJavaScriptDialogShowing(); |
| 589 |
| 590 // If there is a JavaScript dialog up, don't bother sending the renderer the |
| 591 // close event because it is known unresponsive, waiting for the reply from |
| 592 // the dialog. |
| 593 if (IsRenderViewLive() && !is_javascript_dialog_showing) { |
| 589 // Since we are sending an IPC message to the renderer, increase the event | 594 // Since we are sending an IPC message to the renderer, increase the event |
| 590 // count to prevent the hang monitor timeout from being stopped by input | 595 // count to prevent the hang monitor timeout from being stopped by input |
| 591 // event acknowledgements. | 596 // event acknowledgments. |
| 592 GetWidget()->increment_in_flight_event_count(); | 597 GetWidget()->increment_in_flight_event_count(); |
| 593 | 598 |
| 594 // TODO(creis): Should this be moved to Shutdown? It may not be called for | 599 // TODO(creis): Should this be moved to Shutdown? It may not be called for |
| 595 // RenderViewHosts that have been swapped out. | 600 // RenderViewHosts that have been swapped out. |
| 596 NotificationService::current()->Notify( | 601 NotificationService::current()->Notify( |
| 597 NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, | 602 NOTIFICATION_RENDER_VIEW_HOST_WILL_CLOSE_RENDER_VIEW, |
| 598 Source<RenderViewHost>(this), | 603 Source<RenderViewHost>(this), |
| 599 NotificationService::NoDetails()); | 604 NotificationService::NoDetails()); |
| 600 | 605 |
| 601 Send(new ViewMsg_ClosePage(GetRoutingID())); | 606 Send(new ViewMsg_ClosePage(GetRoutingID())); |
| 602 } else { | 607 } else { |
| 603 // This RenderViewHost doesn't have a live renderer, so just skip the unload | 608 // This RenderViewHost doesn't have a live renderer, so just skip the close |
| 604 // event and close the page. | 609 // event and close the page. |
| 605 ClosePageIgnoringUnloadEvents(); | 610 ClosePageIgnoringUnloadEvents(); |
| 606 } | 611 } |
| 607 } | 612 } |
| 608 | 613 |
| 609 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { | 614 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { |
| 610 GetWidget()->StopHangMonitorTimeout(); | 615 GetWidget()->StopHangMonitorTimeout(); |
| 611 is_waiting_for_close_ack_ = false; | 616 is_waiting_for_close_ack_ = false; |
| 612 | 617 |
| 613 sudden_termination_allowed_ = true; | 618 sudden_termination_allowed_ = true; |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 // Note: We are using the origin URL provided by the sender here. It may be | 1331 // Note: We are using the origin URL provided by the sender here. It may be |
| 1327 // different from the receiver's. | 1332 // different from the receiver's. |
| 1328 file_system_file.url = | 1333 file_system_file.url = |
| 1329 GURL(storage::GetIsolatedFileSystemRootURIString( | 1334 GURL(storage::GetIsolatedFileSystemRootURIString( |
| 1330 file_system_url.origin(), filesystem_id, std::string()) | 1335 file_system_url.origin(), filesystem_id, std::string()) |
| 1331 .append(register_name)); | 1336 .append(register_name)); |
| 1332 } | 1337 } |
| 1333 } | 1338 } |
| 1334 | 1339 |
| 1335 } // namespace content | 1340 } // namespace content |
| OLD | NEW |