Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: content/browser/tab_contents/interstitial_page.cc

Issue 6878089: Add and use a base::i18n::StringWithDirection for carrying titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 376 }
377 377
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(
387 int32 page_id, 387 RenderViewHost* render_view_host,
388 const string16& title, 388 int32 page_id,
389 WebKit::WebTextDirection title_direction) { 389 const base::i18n::String16WithDirection& title) {
390 DCHECK(render_view_host == render_view_host_); 390 DCHECK(render_view_host == render_view_host_);
391 NavigationEntry* entry = tab_->controller().GetActiveEntry(); 391 NavigationEntry* entry = tab_->controller().GetActiveEntry();
392 if (!entry) { 392 if (!entry) {
393 // Crash reports from the field indicate this can be NULL. 393 // Crash reports from the field indicate this can be NULL.
394 // This is unexpected as InterstitialPages constructed with the 394 // This is unexpected as InterstitialPages constructed with the
395 // new_navigation flag set to true create a transient navigation entry 395 // new_navigation flag set to true create a transient navigation entry
396 // (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
397 // interstitial created with that flag set to false is with the 397 // interstitial created with that flag set to false is with the
398 // SafeBrowsingBlockingPage, when the resource triggering the interstitial 398 // SafeBrowsingBlockingPage, when the resource triggering the interstitial
399 // 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
400 // navigation entry should have been created. 400 // navigation entry should have been created.
401 NOTREACHED(); 401 NOTREACHED();
402 return; 402 return;
403 } 403 }
404 404
405 // 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
406 // 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.
407 if (!new_navigation_ && !should_revert_tab_title_) { 407 if (!new_navigation_ && !should_revert_tab_title_) {
408 original_tab_title_ = UTF16ToWideHack(entry->title()); 408 original_tab_title_ = UTF16ToWideHack(entry->title());
409 should_revert_tab_title_ = true; 409 should_revert_tab_title_ = true;
410 } 410 }
411 // TODO(evan): use directionality of title.
412 // http://code.google.com/p/chromium/issues/detail?id=27094
413 entry->set_title(title); 411 entry->set_title(title);
414 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); 412 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
415 } 413 }
416 414
417 void InterstitialPage::DomOperationResponse(const std::string& json_string, 415 void InterstitialPage::DomOperationResponse(const std::string& json_string,
418 int automation_id) { 416 int automation_id) {
419 if (enabled_) 417 if (enabled_)
420 CommandReceived(json_string); 418 CommandReceived(json_string);
421 } 419 }
422 420
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 732
735 void InterstitialPage::UpdateInspectorSetting(const std::string& key, 733 void InterstitialPage::UpdateInspectorSetting(const std::string& key,
736 const std::string& value) { 734 const std::string& value) {
737 RenderViewHostDelegateHelper::UpdateInspectorSetting( 735 RenderViewHostDelegateHelper::UpdateInspectorSetting(
738 tab_->profile(), key, value); 736 tab_->profile(), key, value);
739 } 737 }
740 738
741 void InterstitialPage::ClearInspectorSettings() { 739 void InterstitialPage::ClearInspectorSettings() {
742 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); 740 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile());
743 } 741 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698