diff options
author | bshe <bshe@chromium.org> | 2015-11-06 15:21:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-06 23:22:11 +0000 |
commit | cd2dd0a028b2f2efe3f1053eb34091e30e0d1548 (patch) | |
tree | a52e4578bdccf3a3b9421d062e9ab06d47859fac /components/url_formatter | |
parent | 964c0baff2687c52a43935fafca4ee07790b047e (diff) | |
download | chromium_src-cd2dd0a028b2f2efe3f1053eb34091e30e0d1548.zip chromium_src-cd2dd0a028b2f2efe3f1053eb34091e30e0d1548.tar.gz chromium_src-cd2dd0a028b2f2efe3f1053eb34091e30e0d1548.tar.bz2 |
Enable url_formatter::ElideUrl and url_formatter::ElideHost for aura Android
Aura Android uses text_utils_gfx.cc and GetStringWidthF is
implemented in the file. So it is safe to use
url_formatter::ElideUrl and url_formatter::ElideHost for
aura Android.
BUG=507792
Review URL: https://codereview.chromium.org/1428593004
Cr-Commit-Position: refs/heads/master@{#358442}
Diffstat (limited to 'components/url_formatter')
-rw-r--r-- | components/url_formatter/BUILD.gn | 9 | ||||
-rw-r--r-- | components/url_formatter/elide_url.cc | 12 | ||||
-rw-r--r-- | components/url_formatter/elide_url.h | 4 | ||||
-rw-r--r-- | components/url_formatter/url_formatter.gyp | 2 |
4 files changed, 14 insertions, 13 deletions
diff --git a/components/url_formatter/BUILD.gn b/components/url_formatter/BUILD.gn index 3b777de..b74ef78 100644 --- a/components/url_formatter/BUILD.gn +++ b/components/url_formatter/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/ui.gni") + source_set("url_formatter") { sources = [ "elide_url.cc", @@ -22,7 +24,7 @@ source_set("url_formatter") { "//url", ] - if (!is_android) { + if (!is_android || use_aura) { deps += [ "//ui/gfx" ] } } @@ -40,11 +42,10 @@ source_set("unit_tests") { "//base", "//net", "//testing/gtest", - "//ui/gfx", "//url", ] - if (is_android) { - deps -= [ "//ui/gfx" ] + if (!is_android || use_aura) { + deps += [ "//ui/gfx" ] } } diff --git a/components/url_formatter/elide_url.cc b/components/url_formatter/elide_url.cc index 80e7866..3d216a6 100644 --- a/components/url_formatter/elide_url.cc +++ b/components/url_formatter/elide_url.cc @@ -13,14 +13,14 @@ #include "url/gurl.h" #include "url/url_constants.h" -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) #include "ui/gfx/text_elider.h" // nogncheck #include "ui/gfx/text_utils.h" // nogncheck -#endif +#endif // !defined(OS_ANDROID) || defined(USE_AURA) namespace { -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) const base::char16 kDot = '.'; // Build a path from the first |num_components| elements in |path_elements|. @@ -102,7 +102,7 @@ void SplitHost(const GURL& url, } } -#endif // !defined(OS_ANDROID) +#endif // !defined(OS_ANDROID) || defined(USE_AURA) base::string16 FormatUrlForSecurityDisplayInternal(const GURL& url, const std::string& languages, @@ -154,7 +154,7 @@ base::string16 FormatUrlForSecurityDisplayInternal(const GURL& url, namespace url_formatter { -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // TODO(pkasting): http://crbug.com/77883 This whole function gets // kerning/ligatures/etc. issues potentially wrong by assuming that the width of @@ -354,7 +354,7 @@ base::string16 ElideHost(const GURL& url, return elided_subdomain + url_domain; } -#endif // !defined(OS_ANDROID) +#endif // !defined(OS_ANDROID) || defined(USE_AURA) base::string16 FormatUrlForSecurityDisplay(const GURL& url, const std::string& languages) { diff --git a/components/url_formatter/elide_url.h b/components/url_formatter/elide_url.h index 74777de..73c0baa 100644 --- a/components/url_formatter/elide_url.h +++ b/components/url_formatter/elide_url.h @@ -21,7 +21,7 @@ namespace url_formatter { // ElideUrl and Elide host require // gfx::GetStringWidthF which is not implemented in Android -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) || defined(USE_AURA) // 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 @@ -49,7 +49,7 @@ base::string16 ElideUrl(const GURL& url, base::string16 ElideHost(const GURL& host_url, const gfx::FontList& font_list, float available_pixel_width); -#endif // !defined(OS_ANDROID) +#endif // !defined(OS_ANDROID) || defined(USE_AURA) // 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 diff --git a/components/url_formatter/url_formatter.gyp b/components/url_formatter/url_formatter.gyp index 9375e96..304c545 100644 --- a/components/url_formatter/url_formatter.gyp +++ b/components/url_formatter/url_formatter.gyp @@ -28,7 +28,7 @@ 'msvs_disabled_warnings': [4267, ], 'conditions': [ - ['OS != "android"', { + ['OS!="android" or use_aura==1', { 'dependencies': [ '../../ui/gfx/gfx.gyp:gfx', ] |