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