| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/interstitial_page.h" | 5 #include "content/browser/tab_contents/interstitial_page.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used | 368 // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used |
| 369 // by the UI tests) expects to consider a navigation as complete. Without | 369 // by the UI tests) expects to consider a navigation as complete. Without |
| 370 // this, navigating in a UI test to a URL that triggers an interstitial would | 370 // this, navigating in a UI test to a URL that triggers an interstitial would |
| 371 // hang. | 371 // hang. |
| 372 tab_was_loading_ = tab_->IsLoading(); | 372 tab_was_loading_ = tab_->IsLoading(); |
| 373 tab_->SetIsLoading(false, NULL); | 373 tab_->SetIsLoading(false, NULL); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, | 376 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, |
| 377 int32 page_id, | 377 int32 page_id, |
| 378 const string16& title) { | 378 const string16& title, |
| 379 base::i18n::TextDirection title_direction) { |
| 379 DCHECK(render_view_host == render_view_host_); | 380 DCHECK(render_view_host == render_view_host_); |
| 380 NavigationEntry* entry = tab_->controller().GetActiveEntry(); | 381 NavigationEntry* entry = tab_->controller().GetActiveEntry(); |
| 381 if (!entry) { | 382 if (!entry) { |
| 382 // Crash reports from the field indicate this can be NULL. | 383 // Crash reports from the field indicate this can be NULL. |
| 383 // This is unexpected as InterstitialPages constructed with the | 384 // This is unexpected as InterstitialPages constructed with the |
| 384 // new_navigation flag set to true create a transient navigation entry | 385 // new_navigation flag set to true create a transient navigation entry |
| 385 // (that is returned as the active entry). And the only case so far of | 386 // (that is returned as the active entry). And the only case so far of |
| 386 // interstitial created with that flag set to false is with the | 387 // interstitial created with that flag set to false is with the |
| 387 // SafeBrowsingBlockingPage, when the resource triggering the interstitial | 388 // SafeBrowsingBlockingPage, when the resource triggering the interstitial |
| 388 // is a sub-resource, meaning the main page has already been loaded and a | 389 // is a sub-resource, meaning the main page has already been loaded and a |
| 389 // navigation entry should have been created. | 390 // navigation entry should have been created. |
| 390 NOTREACHED(); | 391 NOTREACHED(); |
| 391 return; | 392 return; |
| 392 } | 393 } |
| 393 | 394 |
| 394 // If this interstitial is shown on an existing navigation entry, we'll need | 395 // If this interstitial is shown on an existing navigation entry, we'll need |
| 395 // to remember its title so we can revert to it when hidden. | 396 // to remember its title so we can revert to it when hidden. |
| 396 if (!new_navigation_ && !should_revert_tab_title_) { | 397 if (!new_navigation_ && !should_revert_tab_title_) { |
| 397 original_tab_title_ = entry->title(); | 398 original_tab_title_ = entry->title(); |
| 398 should_revert_tab_title_ = true; | 399 should_revert_tab_title_ = true; |
| 399 } | 400 } |
| 401 // TODO(evan): make use of title_direction. |
| 402 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 400 entry->set_title(title); | 403 entry->set_title(title); |
| 401 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); | 404 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); |
| 402 } | 405 } |
| 403 | 406 |
| 404 RendererPreferences InterstitialPage::GetRendererPrefs( | 407 RendererPreferences InterstitialPage::GetRendererPrefs( |
| 405 content::BrowserContext* browser_context) const { | 408 content::BrowserContext* browser_context) const { |
| 406 return renderer_preferences_; | 409 return renderer_preferences_; |
| 407 } | 410 } |
| 408 | 411 |
| 409 RenderViewHost* InterstitialPage::CreateRenderViewHost() { | 412 RenderViewHost* InterstitialPage::CreateRenderViewHost() { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( | 660 void InterstitialPage::InterstitialPageRVHViewDelegate::TakeFocus( |
| 658 bool reverse) { | 661 bool reverse) { |
| 659 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) | 662 if (interstitial_page_->tab() && interstitial_page_->tab()->GetViewDelegate()) |
| 660 interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); | 663 interstitial_page_->tab()->GetViewDelegate()->TakeFocus(reverse); |
| 661 } | 664 } |
| 662 | 665 |
| 663 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( | 666 void InterstitialPage::InterstitialPageRVHViewDelegate::OnFindReply( |
| 664 int request_id, int number_of_matches, const gfx::Rect& selection_rect, | 667 int request_id, int number_of_matches, const gfx::Rect& selection_rect, |
| 665 int active_match_ordinal, bool final_update) { | 668 int active_match_ordinal, bool final_update) { |
| 666 } | 669 } |
| OLD | NEW |