| 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 "app/text_elider.h" | |
| 9 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/renderer_host/site_instance.h" | 11 #include "chrome/browser/renderer_host/site_instance.h" |
| 13 #include "chrome/browser/tab_contents/navigation_controller.h" | 12 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 14 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 16 #include "grit/app_resources.h" | 15 #include "grit/app_resources.h" |
| 17 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
| 17 #include "ui/base/text/text_elider.h" |
| 18 | 18 |
| 19 // Use this to get a new unique ID for a NavigationEntry during construction. | 19 // Use this to get a new unique ID for a NavigationEntry during construction. |
| 20 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). | 20 // The returned ID is guaranteed to be nonzero (which is the "no ID" indicator). |
| 21 static int GetUniqueID() { | 21 static int GetUniqueID() { |
| 22 static int unique_id_counter = 0; | 22 static int unique_id_counter = 0; |
| 23 return ++unique_id_counter; | 23 return ++unique_id_counter; |
| 24 } | 24 } |
| 25 | 25 |
| 26 NavigationEntry::SSLStatus::SSLStatus() | 26 NavigationEntry::SSLStatus::SSLStatus() |
| 27 : security_style_(SECURITY_STYLE_UNKNOWN), | 27 : security_style_(SECURITY_STYLE_UNKNOWN), |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return cached_display_title_; | 88 return cached_display_title_; |
| 89 | 89 |
| 90 // Use the virtual URL first if any, and fall back on using the real URL. | 90 // Use the virtual URL first if any, and fall back on using the real URL. |
| 91 string16 title; | 91 string16 title; |
| 92 std::wstring elided_title; | 92 std::wstring elided_title; |
| 93 if (!virtual_url_.is_empty()) { | 93 if (!virtual_url_.is_empty()) { |
| 94 title = net::FormatUrl(virtual_url_, languages); | 94 title = net::FormatUrl(virtual_url_, languages); |
| 95 } else if (!url_.is_empty()) { | 95 } else if (!url_.is_empty()) { |
| 96 title = net::FormatUrl(url_, languages); | 96 title = net::FormatUrl(url_, languages); |
| 97 } | 97 } |
| 98 gfx::ElideString(UTF16ToWideHack(title), | 98 ui::ElideString(UTF16ToWideHack(title), chrome::kMaxTitleChars, |
| 99 chrome::kMaxTitleChars, | 99 &elided_title); |
| 100 &elided_title); | |
| 101 cached_display_title_ = WideToUTF16Hack(elided_title); | 100 cached_display_title_ = WideToUTF16Hack(elided_title); |
| 102 return cached_display_title_; | 101 return cached_display_title_; |
| 103 } | 102 } |
| 104 | 103 |
| 105 bool NavigationEntry::IsViewSourceMode() const { | 104 bool NavigationEntry::IsViewSourceMode() const { |
| 106 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); | 105 return virtual_url_.SchemeIs(chrome::kViewSourceScheme); |
| 107 } | 106 } |
| OLD | NEW |