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

Side by Side Diff: chrome/browser/navigation_entry.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 | « chrome/browser/navigation_entry.h ('k') | no next file » | 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_entry.h" 5 #include "chrome/browser/navigation_entry.h"
6 6
7 #include "chrome/common/resource_bundle.h" 7 #include "chrome/common/resource_bundle.h"
8 #include "net/base/escape.h"
8 9
9 // Use this to get a new unique ID for a NavigationEntry during construction. 10 // Use this to get a new unique ID for a NavigationEntry during construction.
10 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). 11 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator).
11 static int GetUniqueID() { 12 static int GetUniqueID() {
12 static int unique_id_counter = 0; 13 static int unique_id_counter = 0;
13 return ++unique_id_counter; 14 return ++unique_id_counter;
14 } 15 }
15 16
16 NavigationEntry::SSLStatus::SSLStatus() 17 NavigationEntry::SSLStatus::SSLStatus()
17 : security_style_(SECURITY_STYLE_UNKNOWN), 18 : security_style_(SECURITY_STYLE_UNKNOWN),
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 url_(url), 52 url_(url),
52 referrer_(referrer), 53 referrer_(referrer),
53 title_(title), 54 title_(title),
54 page_id_(page_id), 55 page_id_(page_id),
55 transition_type_(transition_type), 56 transition_type_(transition_type),
56 has_post_data_(false), 57 has_post_data_(false),
57 restored_(false) { 58 restored_(false) {
58 } 59 }
59 60
60 const std::wstring& NavigationEntry::GetTitleForDisplay() { 61 const std::wstring& NavigationEntry::GetTitleForDisplay() {
61 if (title_.empty()) 62 if (title_.empty()) {
62 return url_as_string_; 63 title_ = UTF8ToWide(url_.ExtractFileName().empty() ?
64 url_.spec() :
65 UnescapeURLComponent(url_.ExtractFileName(),
66 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS));
67 }
63 return title_; 68 return title_;
64 } 69 }
OLDNEW
« no previous file with comments | « chrome/browser/navigation_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698