Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Unified Diff: chrome/browser/ui/elide_url.h

Issue 143463006: Remove net dependency from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add gurl include to elide_url_unittest.cc Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/status_bubble_mac.mm ('k') | chrome/browser/ui/elide_url.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/elide_url.h
diff --git a/chrome/browser/ui/elide_url.h b/chrome/browser/ui/elide_url.h
new file mode 100644
index 0000000000000000000000000000000000000000..4842281bf823bb1ba92a5760255363f13d1fb433
--- /dev/null
+++ b/chrome/browser/ui/elide_url.h
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// This file defines utility functions for eliding URLs.
+
+#ifndef CHROME_BROWSER_UI_ELIDE_URL_H_
+#define CHROME_BROWSER_UI_ELIDE_URL_H_
+
+#include <string>
+
+#include "base/strings/string16.h"
+
+class GURL;
+
+namespace gfx {
+class FontList;
+}
+
+// This function takes a GURL object and elides it. It returns a string
+// which composed of parts from subdomain, domain, path, filename and query.
+// A "..." is added automatically at the end if the elided string is bigger
+// than the |available_pixel_width|. For |available_pixel_width| == 0, a
+// formatted, but un-elided, string is returned. |languages| is a comma
+// separated list of ISO 639 language codes and is used to determine what
+// characters are understood by a user. It should come from
+// |prefs::kAcceptLanguages|.
+//
+// Note: in RTL locales, if the URL returned by this function is going to be
+// displayed in the UI, then it is likely that the string needs to be marked
+// as an LTR string (using base::i18n::WrapStringWithLTRFormatting()) so that it
+// is displayed properly in an RTL context. Please refer to
+// http://crbug.com/6487 for more information.
+base::string16 ElideUrl(const GURL& url,
+ const gfx::FontList& font_list,
+ float available_pixel_width,
+ const std::string& languages);
+
+#endif // CHROME_BROWSER_UI_ELIDE_URL_H_
« no previous file with comments | « chrome/browser/ui/cocoa/status_bubble_mac.mm ('k') | chrome/browser/ui/elide_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698