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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // Notify the tab we are not loading so the throbber is stopped. It also | 378 // Notify the tab we are not loading so the throbber is stopped. It also |
379 // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used | 379 // causes a NOTIFY_LOAD_STOP notification, that the AutomationProvider (used |
380 // by the UI tests) expects to consider a navigation as complete. Without | 380 // by the UI tests) expects to consider a navigation as complete. Without |
381 // this, navigating in a UI test to a URL that triggers an interstitial would | 381 // this, navigating in a UI test to a URL that triggers an interstitial would |
382 // hang. | 382 // hang. |
383 tab_->SetIsLoading(false, NULL); | 383 tab_->SetIsLoading(false, NULL); |
384 } | 384 } |
385 | 385 |
386 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, | 386 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, |
387 int32 page_id, | 387 int32 page_id, |
388 const std::wstring& title) { | 388 const string16& title, |
| 389 WebKit::WebTextDirection title_direction) { |
389 DCHECK(render_view_host == render_view_host_); | 390 DCHECK(render_view_host == render_view_host_); |
390 NavigationEntry* entry = tab_->controller().GetActiveEntry(); | 391 NavigationEntry* entry = tab_->controller().GetActiveEntry(); |
391 if (!entry) { | 392 if (!entry) { |
392 // Crash reports from the field indicate this can be NULL. | 393 // Crash reports from the field indicate this can be NULL. |
393 // This is unexpected as InterstitialPages constructed with the | 394 // This is unexpected as InterstitialPages constructed with the |
394 // new_navigation flag set to true create a transient navigation entry | 395 // new_navigation flag set to true create a transient navigation entry |
395 // (that is returned as the active entry). And the only case so far of | 396 // (that is returned as the active entry). And the only case so far of |
396 // interstitial created with that flag set to false is with the | 397 // interstitial created with that flag set to false is with the |
397 // SafeBrowsingBlockingPage, when the resource triggering the interstitial | 398 // SafeBrowsingBlockingPage, when the resource triggering the interstitial |
398 // is a sub-resource, meaning the main page has already been loaded and a | 399 // is a sub-resource, meaning the main page has already been loaded and a |
399 // navigation entry should have been created. | 400 // navigation entry should have been created. |
400 NOTREACHED(); | 401 NOTREACHED(); |
401 return; | 402 return; |
402 } | 403 } |
403 | 404 |
404 // If this interstitial is shown on an existing navigation entry, we'll need | 405 // If this interstitial is shown on an existing navigation entry, we'll need |
405 // to remember its title so we can revert to it when hidden. | 406 // to remember its title so we can revert to it when hidden. |
406 if (!new_navigation_ && !should_revert_tab_title_) { | 407 if (!new_navigation_ && !should_revert_tab_title_) { |
407 original_tab_title_ = UTF16ToWideHack(entry->title()); | 408 original_tab_title_ = UTF16ToWideHack(entry->title()); |
408 should_revert_tab_title_ = true; | 409 should_revert_tab_title_ = true; |
409 } | 410 } |
410 entry->set_title(WideToUTF16Hack(title)); | 411 // TODO(evan): use directionality of title. |
| 412 // http://code.google.com/p/chromium/issues/detail?id=27094 |
| 413 entry->set_title(title); |
411 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); | 414 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); |
412 } | 415 } |
413 | 416 |
414 void InterstitialPage::DomOperationResponse(const std::string& json_string, | 417 void InterstitialPage::DomOperationResponse(const std::string& json_string, |
415 int automation_id) { | 418 int automation_id) { |
416 if (enabled_) | 419 if (enabled_) |
417 CommandReceived(json_string); | 420 CommandReceived(json_string); |
418 } | 421 } |
419 | 422 |
420 RendererPreferences InterstitialPage::GetRendererPrefs(Profile* profile) const { | 423 RendererPreferences InterstitialPage::GetRendererPrefs(Profile* profile) const { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 734 |
732 void InterstitialPage::UpdateInspectorSetting(const std::string& key, | 735 void InterstitialPage::UpdateInspectorSetting(const std::string& key, |
733 const std::string& value) { | 736 const std::string& value) { |
734 RenderViewHostDelegateHelper::UpdateInspectorSetting( | 737 RenderViewHostDelegateHelper::UpdateInspectorSetting( |
735 tab_->profile(), key, value); | 738 tab_->profile(), key, value); |
736 } | 739 } |
737 | 740 |
738 void InterstitialPage::ClearInspectorSettings() { | 741 void InterstitialPage::ClearInspectorSettings() { |
739 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); | 742 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); |
740 } | 743 } |
OLD | NEW |