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

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

Issue 6901003: Revert my recent changes regarding title directionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyrights 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 tab_->render_view_host()->view()->Focus(); 263 tab_->render_view_host()->view()->Focus();
264 } 264 }
265 265
266 render_view_host_->Shutdown(); 266 render_view_host_->Shutdown();
267 render_view_host_ = NULL; 267 render_view_host_ = NULL;
268 if (tab_->interstitial_page()) 268 if (tab_->interstitial_page())
269 tab_->remove_interstitial_page(); 269 tab_->remove_interstitial_page();
270 // Let's revert to the original title if necessary. 270 // Let's revert to the original title if necessary.
271 NavigationEntry* entry = tab_->controller().GetActiveEntry(); 271 NavigationEntry* entry = tab_->controller().GetActiveEntry();
272 if (!new_navigation_ && should_revert_tab_title_) { 272 if (!new_navigation_ && should_revert_tab_title_) {
273 entry->set_title(original_tab_title_); 273 entry->set_title(WideToUTF16Hack(original_tab_title_));
274 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); 274 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
275 } 275 }
276 delete this; 276 delete this;
277 } 277 }
278 278
279 void InterstitialPage::Observe(NotificationType type, 279 void InterstitialPage::Observe(NotificationType type,
280 const NotificationSource& source, 280 const NotificationSource& source,
281 const NotificationDetails& details) { 281 const NotificationDetails& details) {
282 switch (type.value) { 282 switch (type.value) {
283 case NotificationType::NAV_ENTRY_PENDING: 283 case NotificationType::NAV_ENTRY_PENDING:
(...skipping 92 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( 386 void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host,
387 RenderViewHost* render_view_host, 387 int32 page_id,
388 int32 page_id, 388 const std::wstring& title) {
389 const base::i18n::String16WithDirection& title) {
390 DCHECK(render_view_host == render_view_host_); 389 DCHECK(render_view_host == render_view_host_);
391 NavigationEntry* entry = tab_->controller().GetActiveEntry(); 390 NavigationEntry* entry = tab_->controller().GetActiveEntry();
392 if (!entry) { 391 if (!entry) {
393 // Crash reports from the field indicate this can be NULL. 392 // Crash reports from the field indicate this can be NULL.
394 // This is unexpected as InterstitialPages constructed with the 393 // This is unexpected as InterstitialPages constructed with the
395 // new_navigation flag set to true create a transient navigation entry 394 // 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 395 // (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 396 // interstitial created with that flag set to false is with the
398 // SafeBrowsingBlockingPage, when the resource triggering the interstitial 397 // SafeBrowsingBlockingPage, when the resource triggering the interstitial
399 // is a sub-resource, meaning the main page has already been loaded and a 398 // is a sub-resource, meaning the main page has already been loaded and a
400 // navigation entry should have been created. 399 // navigation entry should have been created.
401 NOTREACHED(); 400 NOTREACHED();
402 return; 401 return;
403 } 402 }
404 403
405 // If this interstitial is shown on an existing navigation entry, we'll need 404 // 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. 405 // to remember its title so we can revert to it when hidden.
407 if (!new_navigation_ && !should_revert_tab_title_) { 406 if (!new_navigation_ && !should_revert_tab_title_) {
408 original_tab_title_ = entry->title(); 407 original_tab_title_ = UTF16ToWideHack(entry->title());
409 should_revert_tab_title_ = true; 408 should_revert_tab_title_ = true;
410 } 409 }
411 entry->set_title(title); 410 entry->set_title(WideToUTF16Hack(title));
412 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); 411 tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
413 } 412 }
414 413
415 void InterstitialPage::DomOperationResponse(const std::string& json_string, 414 void InterstitialPage::DomOperationResponse(const std::string& json_string,
416 int automation_id) { 415 int automation_id) {
417 if (enabled_) 416 if (enabled_)
418 CommandReceived(json_string); 417 CommandReceived(json_string);
419 } 418 }
420 419
421 RendererPreferences InterstitialPage::GetRendererPrefs(Profile* profile) const { 420 RendererPreferences InterstitialPage::GetRendererPrefs(Profile* profile) const {
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 731
733 void InterstitialPage::UpdateInspectorSetting(const std::string& key, 732 void InterstitialPage::UpdateInspectorSetting(const std::string& key,
734 const std::string& value) { 733 const std::string& value) {
735 RenderViewHostDelegateHelper::UpdateInspectorSetting( 734 RenderViewHostDelegateHelper::UpdateInspectorSetting(
736 tab_->profile(), key, value); 735 tab_->profile(), key, value);
737 } 736 }
738 737
739 void InterstitialPage::ClearInspectorSettings() { 738 void InterstitialPage::ClearInspectorSettings() {
740 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile()); 739 RenderViewHostDelegateHelper::ClearInspectorSettings(tab_->profile());
741 } 740 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/interstitial_page.h ('k') | content/browser/tab_contents/navigation_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698