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/interstitial_page_impl.h" | 5 #include "content/browser/web_contents/interstitial_page_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // delegate method, and we can't delete the RVH out from under itself. | 268 // delegate method, and we can't delete the RVH out from under itself. |
269 base::MessageLoop::current()->PostNonNestableTask( | 269 base::MessageLoop::current()->PostNonNestableTask( |
270 FROM_HERE, | 270 FROM_HERE, |
271 base::Bind(&InterstitialPageImpl::Shutdown, | 271 base::Bind(&InterstitialPageImpl::Shutdown, |
272 weak_ptr_factory_.GetWeakPtr(), | 272 weak_ptr_factory_.GetWeakPtr(), |
273 render_view_host_)); | 273 render_view_host_)); |
274 render_view_host_ = NULL; | 274 render_view_host_ = NULL; |
275 frame_tree_.SwapMainFrame(NULL); | 275 frame_tree_.SwapMainFrame(NULL); |
276 web_contents_->DetachInterstitialPage(); | 276 web_contents_->DetachInterstitialPage(); |
277 // Let's revert to the original title if necessary. | 277 // Let's revert to the original title if necessary. |
278 NavigationEntry* entry = web_contents_->GetController().GetActiveEntry(); | 278 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry(); |
279 if (!new_navigation_ && should_revert_web_contents_title_) { | 279 if (!new_navigation_ && should_revert_web_contents_title_) { |
280 entry->SetTitle(original_web_contents_title_); | 280 entry->SetTitle(original_web_contents_title_); |
281 web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); | 281 web_contents_->NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); |
282 } | 282 } |
283 | 283 |
284 InterstitialPageMap::iterator iter = | 284 InterstitialPageMap::iterator iter = |
285 g_web_contents_to_interstitial_page->find(web_contents_); | 285 g_web_contents_to_interstitial_page->find(web_contents_); |
286 DCHECK(iter != g_web_contents_to_interstitial_page->end()); | 286 DCHECK(iter != g_web_contents_to_interstitial_page->end()); |
287 if (iter != g_web_contents_to_interstitial_page->end()) | 287 if (iter != g_web_contents_to_interstitial_page->end()) |
288 g_web_contents_to_interstitial_page->erase(iter); | 288 g_web_contents_to_interstitial_page->erase(iter); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 void InterstitialPageImpl::UpdateTitle( | 409 void InterstitialPageImpl::UpdateTitle( |
410 RenderViewHost* render_view_host, | 410 RenderViewHost* render_view_host, |
411 int32 page_id, | 411 int32 page_id, |
412 const string16& title, | 412 const string16& title, |
413 base::i18n::TextDirection title_direction) { | 413 base::i18n::TextDirection title_direction) { |
414 if (!enabled()) | 414 if (!enabled()) |
415 return; | 415 return; |
416 | 416 |
417 DCHECK(render_view_host == render_view_host_); | 417 DCHECK(render_view_host == render_view_host_); |
418 NavigationEntry* entry = web_contents_->GetController().GetActiveEntry(); | 418 NavigationEntry* entry = web_contents_->GetController().GetVisibleEntry(); |
419 if (!entry) { | 419 if (!entry) { |
420 // Crash reports from the field indicate this can be NULL. | 420 // Crash reports from the field indicate this can be NULL. |
421 // This is unexpected as InterstitialPages constructed with the | 421 // This is unexpected as InterstitialPages constructed with the |
422 // new_navigation flag set to true create a transient navigation entry | 422 // new_navigation flag set to true create a transient navigation entry |
423 // (that is returned as the active entry). And the only case so far of | 423 // (that is returned as the active entry). And the only case so far of |
424 // interstitial created with that flag set to false is with the | 424 // interstitial created with that flag set to false is with the |
425 // SafeBrowsingBlockingPage, when the resource triggering the interstitial | 425 // SafeBrowsingBlockingPage, when the resource triggering the interstitial |
426 // is a sub-resource, meaning the main page has already been loaded and a | 426 // is a sub-resource, meaning the main page has already been loaded and a |
427 // navigation entry should have been created. | 427 // navigation entry should have been created. |
428 NOTREACHED(); | 428 NOTREACHED(); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 819 |
820 web_contents->GetDelegateView()->TakeFocus(reverse); | 820 web_contents->GetDelegateView()->TakeFocus(reverse); |
821 } | 821 } |
822 | 822 |
823 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( | 823 void InterstitialPageImpl::InterstitialPageRVHDelegateView::OnFindReply( |
824 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 824 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
825 int active_match_ordinal, bool final_update) { | 825 int active_match_ordinal, bool final_update) { |
826 } | 826 } |
827 | 827 |
828 } // namespace content | 828 } // namespace content |
OLD | NEW |