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

Unified Diff: components/secure_display/elide_url.h

Issue 1233313005: Move elide_url to its own component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add cast to fix windows bot Created 5 years, 5 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
Index: components/secure_display/elide_url.h
diff --git a/chrome/browser/ui/elide_url.h b/components/secure_display/elide_url.h
similarity index 68%
rename from chrome/browser/ui/elide_url.h
rename to components/secure_display/elide_url.h
index b68267cb6d23568496f79644ed2e1aed49d80723..48a1e126c15757c6636ef7709ee24ca42ff8afde 100644
--- a/chrome/browser/ui/elide_url.h
+++ b/components/secure_display/elide_url.h
@@ -4,12 +4,13 @@
//
// This file defines utility functions for eliding URLs.
-#ifndef CHROME_BROWSER_UI_ELIDE_URL_H_
-#define CHROME_BROWSER_UI_ELIDE_URL_H_
+#ifndef COMPONENTS_SECURE_DISPLAY_ELIDE_URL_H_
+#define COMPONENTS_SECURE_DISPLAY_ELIDE_URL_H_
#include <string>
#include "base/strings/string16.h"
+#include "components/secure_display/secure_display_export.h"
class GURL;
@@ -17,6 +18,11 @@ namespace gfx {
class FontList;
}
+namespace secure_display {
+
+// ElideUrl and Elide host require
+// gfx::GetStringWidthF which is not implemented in Android
+#if !defined(OS_ANDROID)
// 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
@@ -31,19 +37,20 @@ class FontList;
// 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);
+base::string16 SECURE_DISPLAY_EXPORT ElideUrl(const GURL& url,
+ const gfx::FontList& font_list,
+ float available_pixel_width,
+ const std::string& languages);
// This function takes a GURL object and elides the host to fit within
// the given width. The function will never elide past the TLD+1 point,
// but after that, will leading-elide the domain name to fit the width.
// Example: http://sub.domain.com ---> "...domain.com", or "...b.domain.com"
// depending on the width.
-base::string16 ElideHost(const GURL& host_url,
- const gfx::FontList& font_list,
- float available_pixel_width);
+base::string16 SECURE_DISPLAY_EXPORT ElideHost(const GURL& host_url,
+ const gfx::FontList& font_list,
+ float available_pixel_width);
+#endif
noyau (Ping after 24h) 2015/07/22 09:44:00 nit: everywhere you added a #define please recall
Miguel Garcia 2015/07/22 12:33:07 Done. I also fixed the previous ifdefs in these fi
// This is a convenience function for formatting a URL in a concise and
// human-friendly way, to help users make security-related decisions (or in
@@ -58,7 +65,9 @@ base::string16 ElideHost(const GURL& host_url,
// - Omits the port if it is the default for the scheme.
//
// Do not use this for URLs which will be parsed or sent to other applications.
-base::string16 FormatUrlForSecurityDisplay(const GURL& origin,
- const std::string& languages);
+base::string16 SECURE_DISPLAY_EXPORT
+FormatUrlForSecurityDisplay(const GURL& origin, const std::string& languages);
+
+} // namespace
noyau (Ping after 24h) 2015/07/22 09:44:00 nit: Please repeat the name of the namespace in th
Miguel Garcia 2015/07/22 12:33:07 Done.
noyau (Ping after 24h) 2015/07/22 12:44:34 Apparently not…
-#endif // CHROME_BROWSER_UI_ELIDE_URL_H_
+#endif // COMPONENTS_SECURE_DISPLAY_ELIDE_URL_H_

Powered by Google App Engine
This is Rietveld 408576698