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

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

Issue 8973: Unescape and use the filename when we have no title to display for a given en... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/navigation_entry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/navigation_controller.h" 5 #include "chrome/browser/navigation_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (active && active->SupportsURL(&real_url)) 484 if (active && active->SupportsURL(&real_url))
485 type = active->type(); 485 type = active->type();
486 else 486 else
487 type = TabContents::TypeForURL(&real_url); 487 type = TabContents::TypeForURL(&real_url);
488 488
489 NavigationEntry* entry = new NavigationEntry(type, NULL, -1, real_url, 489 NavigationEntry* entry = new NavigationEntry(type, NULL, -1, real_url,
490 referrer, 490 referrer,
491 std::wstring(), transition); 491 std::wstring(), transition);
492 entry->set_display_url(url); 492 entry->set_display_url(url);
493 entry->set_user_typed_url(url); 493 entry->set_user_typed_url(url);
494 if (url.SchemeIsFile()) {
495 entry->set_title(file_util::GetFilenameFromPath(UTF8ToWide(url.host() +
496 url.path())));
497 }
498 return entry; 494 return entry;
499 } 495 }
500 496
501 void NavigationController::AddTransientEntry(NavigationEntry* entry) { 497 void NavigationController::AddTransientEntry(NavigationEntry* entry) {
502 // Discard any current transient entry, we can only have one at a time. 498 // Discard any current transient entry, we can only have one at a time.
503 int index = 0; 499 int index = 0;
504 if (last_committed_entry_index_ != -1) 500 if (last_committed_entry_index_ != -1)
505 index = last_committed_entry_index_ + 1; 501 index = last_committed_entry_index_ + 1;
506 DiscardTransientEntry(); 502 DiscardTransientEntry();
507 entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry)); 503 entries_.insert(entries_.begin() + index, linked_ptr<NavigationEntry>(entry));
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 return i; 1236 return i;
1241 } 1237 }
1242 return -1; 1238 return -1;
1243 } 1239 }
1244 1240
1245 NavigationEntry* NavigationController::GetTransientEntry() const { 1241 NavigationEntry* NavigationController::GetTransientEntry() const {
1246 if (transient_entry_index_ == -1) 1242 if (transient_entry_index_ == -1)
1247 return NULL; 1243 return NULL;
1248 return entries_[transient_entry_index_].get(); 1244 return entries_[transient_entry_index_].get();
1249 } 1245 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/navigation_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698