OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/tab_contents/interstitial_page.h" | 5 #include "chrome/browser/tab_contents/interstitial_page.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/thread.h" | 9 #include "base/thread.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // this, navigating in a UI test to a URL that triggers an interstitial would | 328 // this, navigating in a UI test to a URL that triggers an interstitial would |
329 // hang. | 329 // hang. |
330 tab_->SetIsLoading(false, NULL); | 330 tab_->SetIsLoading(false, NULL); |
331 } | 331 } |
332 | 332 |
333 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, | 333 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, |
334 int32 page_id, | 334 int32 page_id, |
335 const std::wstring& title) { | 335 const std::wstring& title) { |
336 DCHECK(render_view_host == render_view_host_); | 336 DCHECK(render_view_host == render_view_host_); |
337 NavigationEntry* entry = tab_->controller().GetActiveEntry(); | 337 NavigationEntry* entry = tab_->controller().GetActiveEntry(); |
| 338 if (!entry) { |
| 339 // Crash reports from the field indicate this can be NULL. |
| 340 // This is unexpected as InterstitialPages constructed with the |
| 341 // new_navigation flag set to true create a transient navigation entry |
| 342 // (that is returned as the active entry). And the only case so far of |
| 343 // interstitial created with that flag set to false is with the |
| 344 // SafeBrowsingBlockingPage, when the resource triggering the interstitial |
| 345 // is a sub-resource, meaning the main page has already been loaded and a |
| 346 // navigation entry should have been created. |
| 347 NOTREACHED(); |
| 348 return; |
| 349 } |
| 350 |
338 // If this interstitial is shown on an existing navigation entry, we'll need | 351 // If this interstitial is shown on an existing navigation entry, we'll need |
339 // to remember its title so we can revert to it when hidden. | 352 // to remember its title so we can revert to it when hidden. |
340 if (!new_navigation_ && !should_revert_tab_title_) { | 353 if (!new_navigation_ && !should_revert_tab_title_) { |
341 original_tab_title_ = UTF16ToWideHack(entry->title()); | 354 original_tab_title_ = UTF16ToWideHack(entry->title()); |
342 should_revert_tab_title_ = true; | 355 should_revert_tab_title_ = true; |
343 } | 356 } |
344 entry->set_title(WideToUTF16Hack(title)); | 357 entry->set_title(WideToUTF16Hack(title)); |
345 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); | 358 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); |
346 } | 359 } |
347 | 360 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 | 577 |
565 void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseLeave() { | 578 void InterstitialPage::InterstitialPageRVHViewDelegate::HandleMouseLeave() { |
566 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) | 579 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) |
567 interstitial_page_->tab()->GetViewDelegate()->HandleMouseLeave(); | 580 interstitial_page_->tab()->GetViewDelegate()->HandleMouseLeave(); |
568 } | 581 } |
569 | 582 |
570 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 583 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
571 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 584 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
572 int active_match_ordinal, bool final_update) { | 585 int active_match_ordinal, bool final_update) { |
573 } | 586 } |
OLD | NEW |