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

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

Issue 56053: URL's not properly unescaping when displayed (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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 "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"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "chrome/browser/browser_about_handler.h" 12 #include "chrome/browser/browser_about_handler.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/browser_url_handler.h" 14 #include "chrome/browser/browser_url_handler.h"
15 #include "chrome/browser/sessions/session_types.h" 15 #include "chrome/browser/sessions/session_types.h"
16 #include "chrome/browser/tab_contents/navigation_entry.h" 16 #include "chrome/browser/tab_contents/navigation_entry.h"
17 #include "chrome/browser/tab_contents/repost_form_warning.h" 17 #include "chrome/browser/tab_contents/repost_form_warning.h"
18 #include "chrome/browser/tab_contents/site_instance.h" 18 #include "chrome/browser/tab_contents/site_instance.h"
19 #include "chrome/common/navigation_types.h" 19 #include "chrome/common/navigation_types.h"
20 #include "chrome/common/notification_service.h" 20 #include "chrome/common/notification_service.h"
21 #include "chrome/common/pref_names.h"
22 #include "chrome/common/pref_service.h"
21 #include "chrome/common/render_messages.h" 23 #include "chrome/common/render_messages.h"
22 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
23 #include "grit/app_resources.h" 25 #include "grit/app_resources.h"
26 #include "net/base/escape.h"
27 #include "net/base/net_util.h"
24 #include "webkit/glue/webkit_glue.h" 28 #include "webkit/glue/webkit_glue.h"
25 29
26 #if defined(OS_WIN) 30 #if defined(OS_WIN)
27 #include "chrome/browser/tab_contents/repost_form_warning.h" 31 #include "chrome/browser/tab_contents/repost_form_warning.h"
28 #include "chrome/browser/tab_contents/tab_contents.h" 32 #include "chrome/browser/tab_contents/tab_contents.h"
29 #include "chrome/browser/tab_contents/tab_contents_delegate.h" 33 #include "chrome/browser/tab_contents/tab_contents_delegate.h"
30 #endif 34 #endif
31 35
32 namespace { 36 namespace {
33 37
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // will actually be loaded. This real URL won't be shown to the user, just 351 // will actually be loaded. This real URL won't be shown to the user, just
348 // used internally. 352 // used internally.
349 GURL loaded_url(url); 353 GURL loaded_url(url);
350 BrowserURLHandler::RewriteURLIfNecessary(&loaded_url); 354 BrowserURLHandler::RewriteURLIfNecessary(&loaded_url);
351 355
352 NavigationEntry* entry = new NavigationEntry(NULL, -1, loaded_url, referrer, 356 NavigationEntry* entry = new NavigationEntry(NULL, -1, loaded_url, referrer,
353 string16(), transition); 357 string16(), transition);
354 entry->set_display_url(url); 358 entry->set_display_url(url);
355 entry->set_user_typed_url(url); 359 entry->set_user_typed_url(url);
356 if (url.SchemeIsFile()) { 360 if (url.SchemeIsFile()) {
361 std::wstring languages = profile()->GetPrefs()->GetString(
362 prefs::kAcceptLanguages);
357 entry->set_title(WideToUTF16Hack( 363 entry->set_title(WideToUTF16Hack(
358 file_util::GetFilenameFromPath(UTF8ToWide(url.host() + url.path())))); 364 file_util::GetFilenameFromPath(net::FormatUrl(url, languages))));
359 } 365 }
360 return entry; 366 return entry;
361 } 367 }
362 368
363 void NavigationController::AddTransientEntry(NavigationEntry* entry) { 369 void NavigationController::AddTransientEntry(NavigationEntry* entry) {
364 // Discard any current transient entry, we can only have one at a time. 370 // Discard any current transient entry, we can only have one at a time.
365 int index = 0; 371 int index = 0;
366 if (last_committed_entry_index_ != -1) 372 if (last_committed_entry_index_ != -1)
367 index = last_committed_entry_index_ + 1; 373 index = last_committed_entry_index_ + 1;
368 DiscardTransientEntry(); 374 DiscardTransientEntry();
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 return i; 972 return i;
967 } 973 }
968 return -1; 974 return -1;
969 } 975 }
970 976
971 NavigationEntry* NavigationController::GetTransientEntry() const { 977 NavigationEntry* NavigationController::GetTransientEntry() const {
972 if (transient_entry_index_ == -1) 978 if (transient_entry_index_ == -1)
973 return NULL; 979 return NULL;
974 return entries_[transient_entry_index_].get(); 980 return entries_[transient_entry_index_].get();
975 } 981 }
OLDNEW
« no previous file with comments | « chrome/browser/net/url_fixer_upper.cc ('k') | chrome/browser/tab_contents/render_view_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698