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

Side by Side Diff: chrome/browser/tab_contents/navigation_controller.cc

Issue 39022: Convert NavigationEntry title to string16. TabContents::GetTitle no longer ne... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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) 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/navigation_controller.h" 5 #include "chrome/browser/tab_contents/navigation_controller.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 else 468 else
469 type = TabContents::TypeForURL(&real_url); 469 type = TabContents::TypeForURL(&real_url);
470 470
471 if (url.SchemeIs(chrome::kViewSourceScheme)) { 471 if (url.SchemeIs(chrome::kViewSourceScheme)) {
472 // Load the inner URL instead, setting the original URL as the "display". 472 // Load the inner URL instead, setting the original URL as the "display".
473 real_url = GURL(url.path()); 473 real_url = GURL(url.path());
474 } 474 }
475 475
476 NavigationEntry* entry = new NavigationEntry(type, NULL, -1, real_url, 476 NavigationEntry* entry = new NavigationEntry(type, NULL, -1, real_url,
477 referrer, 477 referrer,
478 std::wstring(), transition); 478 string16(), transition);
479 entry->set_display_url(url); 479 entry->set_display_url(url);
480 entry->set_user_typed_url(url); 480 entry->set_user_typed_url(url);
481 if (url.SchemeIsFile()) { 481 if (url.SchemeIsFile()) {
482 entry->set_title(file_util::GetFilenameFromPath(UTF8ToWide(url.host() + 482 entry->set_title(WideToUTF16Hack(
483 url.path()))); 483 file_util::GetFilenameFromPath(UTF8ToWide(url.host() + url.path()))));
484 } 484 }
485 return entry; 485 return entry;
486 } 486 }
487 487
488 void NavigationController::AddTransientEntry(NavigationEntry* entry) { 488 void NavigationController::AddTransientEntry(NavigationEntry* entry) {
489 // Discard any current transient entry, we can only have one at a time. 489 // Discard any current transient entry, we can only have one at a time.
490 int index = 0; 490 int index = 0;
491 if (last_committed_entry_index_ != -1) 491 if (last_committed_entry_index_ != -1)
492 index = last_committed_entry_index_ + 1; 492 index = last_committed_entry_index_ + 1;
493 DiscardTransientEntry(); 493 DiscardTransientEntry();
(...skipping 12 matching lines...) Expand all
506 506
507 LoadEntry(entry); 507 LoadEntry(entry);
508 } 508 }
509 509
510 void NavigationController::LoadURLLazily(const GURL& url, 510 void NavigationController::LoadURLLazily(const GURL& url,
511 const GURL& referrer, 511 const GURL& referrer,
512 PageTransition::Type type, 512 PageTransition::Type type,
513 const std::wstring& title, 513 const std::wstring& title,
514 SkBitmap* icon) { 514 SkBitmap* icon) {
515 NavigationEntry* entry = CreateNavigationEntry(url, referrer, type); 515 NavigationEntry* entry = CreateNavigationEntry(url, referrer, type);
516 entry->set_title(title); 516 entry->set_title(WideToUTF16Hack(title));
517 if (icon) 517 if (icon)
518 entry->favicon().set_bitmap(*icon); 518 entry->favicon().set_bitmap(*icon);
519 519
520 DiscardNonCommittedEntriesInternal(); 520 DiscardNonCommittedEntriesInternal();
521 pending_entry_ = entry; 521 pending_entry_ = entry;
522 load_pending_entry_when_active_ = true; 522 load_pending_entry_when_active_ = true;
523 } 523 }
524 524
525 bool NavigationController::LoadingURLLazily() { 525 bool NavigationController::LoadingURLLazily() {
526 return load_pending_entry_when_active_; 526 return load_pending_entry_when_active_;
527 } 527 }
528 528
529 const std::wstring& NavigationController::GetLazyTitle() const { 529 const string16& NavigationController::GetLazyTitle() const {
530 if (pending_entry_) 530 if (pending_entry_)
531 return pending_entry_->GetTitleForDisplay(); 531 return pending_entry_->GetTitleForDisplay(this);
532 else 532 else
533 return EmptyWString(); 533 return EmptyString16();
534 } 534 }
535 535
536 const SkBitmap& NavigationController::GetLazyFavIcon() const { 536 const SkBitmap& NavigationController::GetLazyFavIcon() const {
537 if (pending_entry_) { 537 if (pending_entry_) {
538 return pending_entry_->favicon().bitmap(); 538 return pending_entry_->favicon().bitmap();
539 } else { 539 } else {
540 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 540 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
541 return *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 541 return *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
542 } 542 }
543 } 543 }
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 return i; 1225 return i;
1226 } 1226 }
1227 return -1; 1227 return -1;
1228 } 1228 }
1229 1229
1230 NavigationEntry* NavigationController::GetTransientEntry() const { 1230 NavigationEntry* NavigationController::GetTransientEntry() const {
1231 if (transient_entry_index_ == -1) 1231 if (transient_entry_index_ == -1)
1232 return NULL; 1232 return NULL;
1233 return entries_[transient_entry_index_].get(); 1233 return entries_[transient_entry_index_].get();
1234 } 1234 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_controller.h ('k') | chrome/browser/tab_contents/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698