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

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

Issue 2861042: Deprecate more old filepath functions. (Closed)
Patch Set: Created 10 years, 5 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
« no previous file with comments | « base/file_util_unittest.cc ('k') | views/drag_utils.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/resource_bundle.h" 7 #include "app/resource_bundle.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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // (TabContents::GetSiteInstance). 248 // (TabContents::GetSiteInstance).
249 -1, 249 -1,
250 loaded_url, 250 loaded_url,
251 referrer, 251 referrer,
252 string16(), 252 string16(),
253 transition); 253 transition);
254 entry->set_virtual_url(url); 254 entry->set_virtual_url(url);
255 entry->set_user_typed_url(url); 255 entry->set_user_typed_url(url);
256 entry->set_update_virtual_url_with_url(reverse_on_redirect); 256 entry->set_update_virtual_url_with_url(reverse_on_redirect);
257 if (url.SchemeIsFile()) { 257 if (url.SchemeIsFile()) {
258 // Use the filename as the title, not the full path.
259 // We need to call FormatUrl() to perform URL de-escaping;
260 // it's a bit ugly to grab the filename out of the resulting string.
258 std::wstring languages = UTF8ToWide(profile->GetPrefs()->GetString( 261 std::wstring languages = UTF8ToWide(profile->GetPrefs()->GetString(
259 prefs::kAcceptLanguages)); 262 prefs::kAcceptLanguages));
260 entry->set_title(WideToUTF16Hack( 263 std::wstring formatted = net::FormatUrl(url, languages);
261 file_util::GetFilenameFromPath(net::FormatUrl(url, languages)))); 264 std::wstring filename =
265 FilePath::FromWStringHack(formatted).BaseName().ToWStringHack();
266 entry->set_title(WideToUTF16Hack(filename));
262 } 267 }
263 return entry; 268 return entry;
264 } 269 }
265 270
266 NavigationEntry* NavigationController::GetEntryWithPageID( 271 NavigationEntry* NavigationController::GetEntryWithPageID(
267 SiteInstance* instance, int32 page_id) const { 272 SiteInstance* instance, int32 page_id) const {
268 int index = GetEntryIndexWithPageID(instance, page_id); 273 int index = GetEntryIndexWithPageID(instance, page_id);
269 return (index != -1) ? entries_[index].get() : NULL; 274 return (index != -1) ? entries_[index].get() : NULL;
270 } 275 }
271 276
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 return i; 1140 return i;
1136 } 1141 }
1137 return -1; 1142 return -1;
1138 } 1143 }
1139 1144
1140 NavigationEntry* NavigationController::GetTransientEntry() const { 1145 NavigationEntry* NavigationController::GetTransientEntry() const {
1141 if (transient_entry_index_ == -1) 1146 if (transient_entry_index_ == -1)
1142 return NULL; 1147 return NULL;
1143 return entries_[transient_entry_index_].get(); 1148 return entries_[transient_entry_index_].get();
1144 } 1149 }
OLDNEW
« no previous file with comments | « base/file_util_unittest.cc ('k') | views/drag_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698