Index: chrome/browser/ui/toolbar/toolbar_model_impl.cc |
diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
index 1d18458e6dd52ab52ff690b69e98d18f9e8be3b6..8bcee75700f1e8fd7ed85d546090468bf4e858dd 100644 |
--- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
@@ -215,6 +215,37 @@ base::string16 ToolbarModelImpl::GetEVCertName() const { |
base::UTF8ToUTF16(cert->subject().country_name)); |
} |
+base::string16 ToolbarModelImpl::GetOriginDisplayName() const { |
+ std::string languages; // Empty if we don't have a |navigation_controller|. |
+ Profile* profile = GetProfile(); |
+ if (profile) |
+ languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
+ |
+ GURL url(GetURL()); |
+ std::string displayed_origin; |
+ |
+ if ("https" == url.scheme() || "http" == url.scheme()) { |
+ displayed_origin = url.host(); |
+ if (url.port().length() > 0 && |
+ (("https" == url.scheme() && "443" != url.port()) || |
+ ("http" == url.scheme() && "80" != url.port()))) { |
+ displayed_origin += ":" + url.port(); |
+ } |
+ } else if ("file" == url.scheme()) { |
+ displayed_origin = url.path(); |
+ } else { |
+ // TODO(palmer): This is inefficient because we are just going to |
+ // convert it back into a GURL for net::FormatUrl. This function gets |
+ // called surprisingly often so it should be fast and clean. |
+ displayed_origin = url.GetOrigin().spec(); |
+ } |
+ |
+ // TODO(palmer): This is just testing: |
+ return base::ASCIIToUTF16(displayed_origin); |
+ |
+ //return net::FormatUrl(GURL(displayed_origin), languages); |
+} |
+ |
bool ToolbarModelImpl::ShouldDisplayURL() const { |
// Note: The order here is important. |
// - The WebUI test must come before the extension scheme test because there |