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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) | 356 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
357 g_created_callbacks.Get().at(i).Run(this); | 357 g_created_callbacks.Get().at(i).Run(this); |
358 frame_tree_.SetFrameRemoveListener( | 358 frame_tree_.SetFrameRemoveListener( |
359 base::Bind(&WebContentsImpl::OnFrameRemoved, | 359 base::Bind(&WebContentsImpl::OnFrameRemoved, |
360 base::Unretained(this))); | 360 base::Unretained(this))); |
361 } | 361 } |
362 | 362 |
363 WebContentsImpl::~WebContentsImpl() { | 363 WebContentsImpl::~WebContentsImpl() { |
364 is_being_destroyed_ = true; | 364 is_being_destroyed_ = true; |
365 | 365 |
| 366 // If there is an interstitial page being shown, tell it to close down early |
| 367 // so that this contents will be alive enough to handle all the UI triggered |
| 368 // by that. <http://crbug.com/363564> |
| 369 InterstitialPageImpl* interstitial_page = |
| 370 static_cast<InterstitialPageImpl*>(GetInterstitialPage()); |
| 371 if (interstitial_page) |
| 372 interstitial_page->WebContentsWillBeDestroyed(); |
| 373 |
366 // Delete all RFH pending shutdown, which will lead the corresponding RVH to | 374 // Delete all RFH pending shutdown, which will lead the corresponding RVH to |
367 // shutdown and be deleted as well. | 375 // shutdown and be deleted as well. |
368 frame_tree_.ForEach( | 376 frame_tree_.ForEach( |
369 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); | 377 base::Bind(&RenderFrameHostManager::ClearRFHsPendingShutdown)); |
370 | 378 |
371 ClearAllPowerSaveBlockers(); | 379 ClearAllPowerSaveBlockers(); |
372 | 380 |
373 for (std::set<RenderWidgetHostImpl*>::iterator iter = | 381 for (std::set<RenderWidgetHostImpl*>::iterator iter = |
374 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { | 382 created_widgets_.begin(); iter != created_widgets_.end(); ++iter) { |
375 (*iter)->DetachDelegate(); | 383 (*iter)->DetachDelegate(); |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 // Cancel any visible dialogs so that they don't interfere with the | 1770 // Cancel any visible dialogs so that they don't interfere with the |
1763 // interstitial. | 1771 // interstitial. |
1764 if (dialog_manager_) | 1772 if (dialog_manager_) |
1765 dialog_manager_->CancelActiveAndPendingDialogs(this); | 1773 dialog_manager_->CancelActiveAndPendingDialogs(this); |
1766 | 1774 |
1767 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1775 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1768 DidAttachInterstitialPage()); | 1776 DidAttachInterstitialPage()); |
1769 } | 1777 } |
1770 | 1778 |
1771 void WebContentsImpl::DetachInterstitialPage() { | 1779 void WebContentsImpl::DetachInterstitialPage() { |
1772 if (GetInterstitialPage()) | 1780 if (ShowingInterstitialPage()) |
1773 GetRenderManager()->remove_interstitial_page(); | 1781 GetRenderManager()->remove_interstitial_page(); |
1774 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 1782 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
1775 DidDetachInterstitialPage()); | 1783 DidDetachInterstitialPage()); |
1776 } | 1784 } |
1777 | 1785 |
1778 void WebContentsImpl::SetHistoryLengthAndPrune( | 1786 void WebContentsImpl::SetHistoryLengthAndPrune( |
1779 const SiteInstance* site_instance, | 1787 const SiteInstance* site_instance, |
1780 int history_length, | 1788 int history_length, |
1781 int32 minimum_page_id) { | 1789 int32 minimum_page_id) { |
1782 // SetHistoryLengthAndPrune doesn't work when there are pending cross-site | 1790 // SetHistoryLengthAndPrune doesn't work when there are pending cross-site |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3904 | 3912 |
3905 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3913 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3906 if (!delegate_) | 3914 if (!delegate_) |
3907 return; | 3915 return; |
3908 const gfx::Size new_size = GetPreferredSize(); | 3916 const gfx::Size new_size = GetPreferredSize(); |
3909 if (new_size != old_size) | 3917 if (new_size != old_size) |
3910 delegate_->UpdatePreferredSize(this, new_size); | 3918 delegate_->UpdatePreferredSize(this, new_size); |
3911 } | 3919 } |
3912 | 3920 |
3913 } // namespace content | 3921 } // namespace content |
OLD | NEW |