diff options
Diffstat (limited to 'components/bookmarks')
-rw-r--r-- | components/bookmarks/DEPS | 1 | ||||
-rw-r--r-- | components/bookmarks/browser/BUILD.gn | 1 | ||||
-rw-r--r-- | components/bookmarks/browser/bookmark_utils.cc | 25 | ||||
-rw-r--r-- | components/bookmarks/browser/bookmark_utils.h | 12 |
4 files changed, 18 insertions, 21 deletions
diff --git a/components/bookmarks/DEPS b/components/bookmarks/DEPS index 75997b1..bc82e28 100644 --- a/components/bookmarks/DEPS +++ b/components/bookmarks/DEPS @@ -4,7 +4,6 @@ include_rules = [ "+components/pref_registry", "+components/query_parser", "+components/startup_metric_utils", - "+components/url_formatter", "+grit/components_strings.h", "+jni", "+net/base", diff --git a/components/bookmarks/browser/BUILD.gn b/components/bookmarks/browser/BUILD.gn index 03aaee9..14ed172 100644 --- a/components/bookmarks/browser/BUILD.gn +++ b/components/bookmarks/browser/BUILD.gn @@ -50,7 +50,6 @@ source_set("browser") { "//components/query_parser", "//components/startup_metric_utils", "//components/strings", - "//components/url_formatter", "//net", "//third_party/icu", "//ui/base", diff --git a/components/bookmarks/browser/bookmark_utils.cc b/components/bookmarks/browser/bookmark_utils.cc index 6d60a4f..a815d1c 100644 --- a/components/bookmarks/browser/bookmark_utils.cc +++ b/components/bookmarks/browser/bookmark_utils.cc @@ -25,7 +25,7 @@ #include "components/bookmarks/common/bookmark_pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/query_parser/query_parser.h" -#include "components/url_formatter/url_formatter.h" +#include "net/base/net_util.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/models/tree_node_iterator.h" #include "url/gurl.h" @@ -96,14 +96,13 @@ bool DoesBookmarkTextContainWords(const base::string16& text, bool DoesBookmarkContainWords(const BookmarkNode* node, const std::vector<base::string16>& words, const std::string& languages) { - return DoesBookmarkTextContainWords(node->GetTitle(), words) || - DoesBookmarkTextContainWords(base::UTF8ToUTF16(node->url().spec()), - words) || - DoesBookmarkTextContainWords( - url_formatter::FormatUrl( - node->url(), languages, url_formatter::kFormatUrlOmitNothing, - net::UnescapeRule::NORMAL, NULL, NULL, NULL), - words); + return + DoesBookmarkTextContainWords(node->GetTitle(), words) || + DoesBookmarkTextContainWords( + base::UTF8ToUTF16(node->url().spec()), words) || + DoesBookmarkTextContainWords(net::FormatUrl( + node->url(), languages, net::kFormatUrlOmitNothing, + net::UnescapeRule::NORMAL, NULL, NULL, NULL), words); } // This is used with a tree iterator to skip subtrees which are not visible. @@ -517,11 +516,11 @@ base::string16 CleanUpUrlForMatching( const std::string& languages, base::OffsetAdjuster::Adjustments* adjustments) { base::OffsetAdjuster::Adjustments tmp_adjustments; - return base::i18n::ToLower(url_formatter::FormatUrlWithAdjustments( + return base::i18n::ToLower(net::FormatUrlWithAdjustments( GURL(TruncateUrl(gurl.spec())), languages, - url_formatter::kFormatUrlOmitUsernamePassword, - net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, NULL, - NULL, adjustments ? adjustments : &tmp_adjustments)); + net::kFormatUrlOmitUsernamePassword, + net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, + NULL, NULL, adjustments ? adjustments : &tmp_adjustments)); } base::string16 CleanUpTitleForMatching(const base::string16& title) { diff --git a/components/bookmarks/browser/bookmark_utils.h b/components/bookmarks/browser/bookmark_utils.h index 32e72d2..57bd4bb 100644 --- a/components/bookmarks/browser/bookmark_utils.h +++ b/components/bookmarks/browser/bookmark_utils.h @@ -112,12 +112,12 @@ void AddIfNotBookmarked(BookmarkModel* model, void RemoveAllBookmarks(BookmarkModel* model, const GURL& url); // Truncates an overly-long URL, unescapes it and interprets the characters -// as UTF-8 (both via url_formatter::FormatUrl()), and lower-cases it, returning -// the result. |languages| is passed to url_formatter::FormatUrl(). -// |adjustments|, if non-NULL, is set to reflect the transformations the URL -// spec underwent to become the return value. If a caller computes offsets -// (e.g., for the position of matched text) in this cleaned-up string, it can -// use |adjustments| to calculate the location of these offsets in the original +// as UTF-8 (both via net::FormatUrl()), and lower-cases it, returning the +// result. |languages| is passed to net::FormatUrl(). |adjustments|, if +// non-NULL, is set to reflect the transformations the URL spec underwent to +// become the return value. If a caller computes offsets (e.g., for the +// position of matched text) in this cleaned-up string, it can use +// |adjustments| to calculate the location of these offsets in the original // string (via base::OffsetAdjuster::UnadjustOffsets()). This is useful if // later the original string gets formatted in a different way for displaying. // In this case, knowing the offsets in the original string will allow them to |