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/gfx/text_elider.h" | |
8 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
9 #include "chrome/browser/tab_contents/navigation_controller.h" | 8 #include "chrome/browser/tab_contents/navigation_controller.h" |
10 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
11 #include "chrome/common/pref_service.h" | 10 #include "chrome/common/pref_service.h" |
12 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "net/base/net_util.h" |
13 | 13 |
14 // Use this to get a new unique ID for a NavigationEntry during construction. | 14 // Use this to get a new unique ID for a NavigationEntry during construction. |
15 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 15 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
16 static int GetUniqueID() { | 16 static int GetUniqueID() { |
17 static int unique_id_counter = 0; | 17 static int unique_id_counter = 0; |
18 return ++unique_id_counter; | 18 return ++unique_id_counter; |
19 } | 19 } |
20 | 20 |
21 NavigationEntry::SSLStatus::SSLStatus() | 21 NavigationEntry::SSLStatus::SSLStatus() |
22 : security_style_(SECURITY_STYLE_UNKNOWN), | 22 : security_style_(SECURITY_STYLE_UNKNOWN), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (!cached_display_title_.empty()) | 72 if (!cached_display_title_.empty()) |
73 return cached_display_title_; | 73 return cached_display_title_; |
74 | 74 |
75 // Use the display URL first if any, and fall back on using the real URL. | 75 // Use the display URL first if any, and fall back on using the real URL. |
76 std::wstring languages; | 76 std::wstring languages; |
77 if (navigation_controller) { | 77 if (navigation_controller) { |
78 languages = navigation_controller->profile()->GetPrefs()->GetString( | 78 languages = navigation_controller->profile()->GetPrefs()->GetString( |
79 prefs::kAcceptLanguages); | 79 prefs::kAcceptLanguages); |
80 } | 80 } |
81 if (!display_url_.is_empty()) { | 81 if (!display_url_.is_empty()) { |
82 cached_display_title_ = WideToUTF16Hack(gfx::GetCleanStringFromUrl( | 82 cached_display_title_ = WideToUTF16Hack(net::FormatUrl( |
83 display_url_, languages, NULL, NULL)); | 83 display_url_, languages)); |
84 } else if (!url_.is_empty()) { | 84 } else if (!url_.is_empty()) { |
85 cached_display_title_ = WideToUTF16Hack(gfx::GetCleanStringFromUrl( | 85 cached_display_title_ = WideToUTF16Hack(net::FormatUrl(url_, languages)); |
86 url_, languages, NULL, NULL)); | |
87 } | 86 } |
88 return cached_display_title_; | 87 return cached_display_title_; |
89 } | 88 } |
90 | 89 |
91 bool NavigationEntry::IsViewSourceMode() const { | 90 bool NavigationEntry::IsViewSourceMode() const { |
92 return display_url_.SchemeIs(chrome::kViewSourceScheme); | 91 return display_url_.SchemeIs(chrome::kViewSourceScheme); |
93 } | 92 } |
OLD | NEW |