| 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_entry.h" | 5 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "chrome/browser/tab_contents/navigation_controller.h" | 9 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Most pages have real titles. Don't even bother caching anything if this is | 67 // Most pages have real titles. Don't even bother caching anything if this is |
| 68 // the case. | 68 // the case. |
| 69 if (!title_.empty()) | 69 if (!title_.empty()) |
| 70 return title_; | 70 return title_; |
| 71 | 71 |
| 72 // More complicated cases will use the URLs as the title. This result we will | 72 // More complicated cases will use the URLs as the title. This result we will |
| 73 // cache since it's more complicated to compute. | 73 // cache since it's more complicated to compute. |
| 74 if (!cached_display_title_.empty()) | 74 if (!cached_display_title_.empty()) |
| 75 return cached_display_title_; | 75 return cached_display_title_; |
| 76 | 76 |
| 77 // Use the display URL first if any, and fall back on using the real URL. | 77 // Use the virtual URL first if any, and fall back on using the real URL. |
| 78 std::wstring languages; | 78 std::wstring languages; |
| 79 if (navigation_controller) { | 79 if (navigation_controller) { |
| 80 languages = navigation_controller->profile()->GetPrefs()->GetString( | 80 languages = navigation_controller->profile()->GetPrefs()->GetString( |
| 81 prefs::kAcceptLanguages); | 81 prefs::kAcceptLanguages); |
| 82 } | 82 } |
| 83 if (!display_url_.is_empty()) { | 83 if (!virtual_url_.is_empty()) { |
| 84 cached_display_title_ = WideToUTF16Hack(net::FormatUrl( | 84 cached_display_title_ = WideToUTF16Hack(net::FormatUrl( |
| 85 display_url_, languages)); | 85 virtual_url_, languages)); |
| 86 } else if (!url_.is_empty()) { | 86 } else if (!url_.is_empty()) { |
| 87 cached_display_title_ = WideToUTF16Hack(net::FormatUrl(url_, languages)); | 87 cached_display_title_ = WideToUTF16Hack(net::FormatUrl(url_, languages)); |
| 88 } | 88 } |
| 89 return cached_display_title_; | 89 return cached_display_title_; |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool NavigationEntry::IsViewSourceMode() const { | 92 bool NavigationEntry::IsViewSourceMode() const { |
| 93 return display_url_.SchemeIs(chrome::kViewSourceScheme); | 93 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); |
| 94 } | 94 } |
| OLD | NEW |