OLD | NEW |
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" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 } | 352 } |
353 | 353 |
354 NavigationEntry* NavigationController::CreateNavigationEntry( | 354 NavigationEntry* NavigationController::CreateNavigationEntry( |
355 const GURL& url, const GURL& referrer, PageTransition::Type transition) { | 355 const GURL& url, const GURL& referrer, PageTransition::Type transition) { |
356 // Allow the browser URL handler to rewrite the URL. This will, for example, | 356 // Allow the browser URL handler to rewrite the URL. This will, for example, |
357 // remove "view-source:" from the beginning of the URL to get the URL that | 357 // remove "view-source:" from the beginning of the URL to get the URL that |
358 // will actually be loaded. This real URL won't be shown to the user, just | 358 // will actually be loaded. This real URL won't be shown to the user, just |
359 // used internally. | 359 // used internally. |
360 GURL loaded_url(url); | 360 GURL loaded_url(url); |
361 BrowserURLHandler::RewriteURLIfNecessary(&loaded_url); | 361 BrowserURLHandler::RewriteURLIfNecessary(&loaded_url, profile_); |
362 | 362 |
363 NavigationEntry* entry = new NavigationEntry(NULL, -1, loaded_url, referrer, | 363 NavigationEntry* entry = new NavigationEntry(NULL, -1, loaded_url, referrer, |
364 string16(), transition); | 364 string16(), transition); |
365 entry->set_virtual_url(url); | 365 entry->set_virtual_url(url); |
366 entry->set_user_typed_url(url); | 366 entry->set_user_typed_url(url); |
367 if (url.SchemeIsFile()) { | 367 if (url.SchemeIsFile()) { |
368 std::wstring languages = profile()->GetPrefs()->GetString( | 368 std::wstring languages = profile()->GetPrefs()->GetString( |
369 prefs::kAcceptLanguages); | 369 prefs::kAcceptLanguages); |
370 entry->set_title(WideToUTF16Hack( | 370 entry->set_title(WideToUTF16Hack( |
371 file_util::GetFilenameFromPath(net::FormatUrl(url, languages)))); | 371 file_util::GetFilenameFromPath(net::FormatUrl(url, languages)))); |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 return i; | 1021 return i; |
1022 } | 1022 } |
1023 return -1; | 1023 return -1; |
1024 } | 1024 } |
1025 | 1025 |
1026 NavigationEntry* NavigationController::GetTransientEntry() const { | 1026 NavigationEntry* NavigationController::GetTransientEntry() const { |
1027 if (transient_entry_index_ == -1) | 1027 if (transient_entry_index_ == -1) |
1028 return NULL; | 1028 return NULL; |
1029 return entries_[transient_entry_index_].get(); | 1029 return entries_[transient_entry_index_].get(); |
1030 } | 1030 } |
OLD | NEW |