| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/interstitial_page_impl.h" | 5 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // been called from a RVH delegate method, and we can't delete the RVH out | 291 // been called from a RVH delegate method, and we can't delete the RVH out |
| 292 // from under itself. | 292 // from under itself. |
| 293 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( | 293 base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask( |
| 294 FROM_HERE, base::Bind(&InterstitialPageImpl::Shutdown, | 294 FROM_HERE, base::Bind(&InterstitialPageImpl::Shutdown, |
| 295 weak_ptr_factory_.GetWeakPtr())); | 295 weak_ptr_factory_.GetWeakPtr())); |
| 296 render_view_host_ = NULL; | 296 render_view_host_ = NULL; |
| 297 frame_tree_.root()->ResetForNewProcess(); | 297 frame_tree_.root()->ResetForNewProcess(); |
| 298 controller_->delegate()->DetachInterstitialPage(); | 298 controller_->delegate()->DetachInterstitialPage(); |
| 299 // Let's revert to the original title if necessary. | 299 // Let's revert to the original title if necessary. |
| 300 NavigationEntry* entry = controller_->GetVisibleEntry(); | 300 NavigationEntry* entry = controller_->GetVisibleEntry(); |
| 301 if (entry && !new_navigation_ && should_revert_web_contents_title_) { | 301 if (entry && !new_navigation_ && should_revert_web_contents_title_) |
| 302 entry->SetTitle(original_web_contents_title_); | 302 web_contents_->UpdateTitleForEntry(entry, original_web_contents_title_); |
| 303 controller_->delegate()->NotifyNavigationStateChanged( | |
| 304 INVALIDATE_TYPE_TITLE); | |
| 305 } | |
| 306 | 303 |
| 307 static_cast<WebContentsImpl*>(web_contents_)->DidChangeVisibleSSLState(); | 304 static_cast<WebContentsImpl*>(web_contents_)->DidChangeVisibleSSLState(); |
| 308 | 305 |
| 309 InterstitialPageMap::iterator iter = | 306 InterstitialPageMap::iterator iter = |
| 310 g_web_contents_to_interstitial_page->find(web_contents_); | 307 g_web_contents_to_interstitial_page->find(web_contents_); |
| 311 DCHECK(iter != g_web_contents_to_interstitial_page->end()); | 308 DCHECK(iter != g_web_contents_to_interstitial_page->end()); |
| 312 if (iter != g_web_contents_to_interstitial_page->end()) | 309 if (iter != g_web_contents_to_interstitial_page->end()) |
| 313 g_web_contents_to_interstitial_page->erase(iter); | 310 g_web_contents_to_interstitial_page->erase(iter); |
| 314 | 311 |
| 315 // Clear the WebContents pointer, because it may now be deleted. | 312 // Clear the WebContents pointer, because it may now be deleted. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 401 } |
| 405 | 402 |
| 406 // If this interstitial is shown on an existing navigation entry, we'll need | 403 // If this interstitial is shown on an existing navigation entry, we'll need |
| 407 // to remember its title so we can revert to it when hidden. | 404 // to remember its title so we can revert to it when hidden. |
| 408 if (!new_navigation_ && !should_revert_web_contents_title_) { | 405 if (!new_navigation_ && !should_revert_web_contents_title_) { |
| 409 original_web_contents_title_ = entry->GetTitle(); | 406 original_web_contents_title_ = entry->GetTitle(); |
| 410 should_revert_web_contents_title_ = true; | 407 should_revert_web_contents_title_ = true; |
| 411 } | 408 } |
| 412 // TODO(evan): make use of title_direction. | 409 // TODO(evan): make use of title_direction. |
| 413 // http://code.google.com/p/chromium/issues/detail?id=27094 | 410 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 414 entry->SetTitle(title); | 411 web_contents_->UpdateTitleForEntry(entry, title); |
| 415 controller_->delegate()->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); | |
| 416 } | 412 } |
| 417 | 413 |
| 418 InterstitialPage* InterstitialPageImpl::GetAsInterstitialPage() { | 414 InterstitialPage* InterstitialPageImpl::GetAsInterstitialPage() { |
| 419 return this; | 415 return this; |
| 420 } | 416 } |
| 421 | 417 |
| 422 AccessibilityMode InterstitialPageImpl::GetAccessibilityMode() const { | 418 AccessibilityMode InterstitialPageImpl::GetAccessibilityMode() const { |
| 423 if (web_contents_) | 419 if (web_contents_) |
| 424 return static_cast<WebContentsImpl*>(web_contents_)->GetAccessibilityMode(); | 420 return static_cast<WebContentsImpl*>(web_contents_)->GetAccessibilityMode(); |
| 425 else | 421 else |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 // means the interstitial was shown as a result of a resource loading in the | 658 // means the interstitial was shown as a result of a resource loading in the |
| 663 // page and we won't return to the original page, so we cancel blocked | 659 // page and we won't return to the original page, so we cancel blocked |
| 664 // requests in that case. | 660 // requests in that case. |
| 665 if (new_navigation_) | 661 if (new_navigation_) |
| 666 TakeActionOnResourceDispatcher(RESUME); | 662 TakeActionOnResourceDispatcher(RESUME); |
| 667 else | 663 else |
| 668 TakeActionOnResourceDispatcher(CANCEL); | 664 TakeActionOnResourceDispatcher(CANCEL); |
| 669 | 665 |
| 670 if (should_discard_pending_nav_entry_) { | 666 if (should_discard_pending_nav_entry_) { |
| 671 // Since no navigation happens we have to discard the transient entry | 667 // Since no navigation happens we have to discard the transient entry |
| 672 // explicitely. Note that by calling DiscardNonCommittedEntries() we also | 668 // explicitly. Note that by calling DiscardNonCommittedEntries() we also |
| 673 // discard the pending entry, which is what we want, since the navigation is | 669 // discard the pending entry, which is what we want, since the navigation is |
| 674 // cancelled. | 670 // cancelled. |
| 675 controller_->DiscardNonCommittedEntries(); | 671 controller_->DiscardNonCommittedEntries(); |
| 676 } | 672 } |
| 677 | 673 |
| 678 if (reload_on_dont_proceed_) | 674 if (reload_on_dont_proceed_) |
| 679 controller_->Reload(true); | 675 controller_->Reload(true); |
| 680 | 676 |
| 681 Hide(); | 677 Hide(); |
| 682 delegate_->OnDontProceed(); | 678 delegate_->OnDontProceed(); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { | 937 void InterstitialPageImpl::UnderlyingContentObserver::WebContentsDestroyed() { |
| 942 interstitial_->OnNavigatingAwayOrTabClosing(); | 938 interstitial_->OnNavigatingAwayOrTabClosing(); |
| 943 } | 939 } |
| 944 | 940 |
| 945 TextInputManager* InterstitialPageImpl::GetTextInputManager() { | 941 TextInputManager* InterstitialPageImpl::GetTextInputManager() { |
| 946 return !web_contents_ ? nullptr : static_cast<WebContentsImpl*>(web_contents_) | 942 return !web_contents_ ? nullptr : static_cast<WebContentsImpl*>(web_contents_) |
| 947 ->GetTextInputManager(); | 943 ->GetTextInputManager(); |
| 948 } | 944 } |
| 949 | 945 |
| 950 } // namespace content | 946 } // namespace content |
| OLD | NEW |