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

Unified Diff: chrome/browser/bookmarks/bookmark_utils.h

Issue 184663002: Omnibox: Make URLs of Bookmarks Searchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter's comments Created 6 years, 8 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: chrome/browser/bookmarks/bookmark_utils.h
diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h
index c8566e728e5b3155f99700dcc9968cdbcb2c829d..38e7f9881a0b0cb33b099484a9bdbf8efe25e9cb 100644
--- a/chrome/browser/bookmarks/bookmark_utils.h
+++ b/chrome/browser/bookmarks/bookmark_utils.h
@@ -14,13 +14,15 @@
class BookmarkModel;
class BookmarkNode;
class Profile;
+class GURL;
namespace user_prefs {
class PrefRegistrySyncable;
}
// A collection of bookmark utility functions used by various parts of the UI
-// that show bookmarks: bookmark manager, bookmark bar view ...
+// that show bookmarks (bookmark manager, bookmark bar view, ...) and other
+// systems that involve indexing and searching bookmarks.
namespace bookmark_utils {
// Fields to use when finding matching bookmarks.
@@ -107,6 +109,21 @@ void AddIfNotBookmarked(BookmarkModel* model,
// Removes all bookmarks for the given |url|.
void RemoveAllBookmarks(BookmarkModel* model, const GURL& url);
+// Truncates an overly-long URL, unescapes it, and lower-cases it,
+// returning the result. This unescaping makes it possible to match
+// substrings that were originally escaped for navigation; for
+// example, if the user searched for "a&p", the query would be escaped
+// as "a%26p", so without unescaping, an input string of "a&p" would
+// no longer match this URL. Note that the resulting unescaped URL
+// may not be directly navigable (which is why we escaped it to begin
+// with). |languages| is passed to net::FormatUrl().
+base::string16 CleanUpUrlForMatching(const GURL& gurl,
+ const std::string& languages);
+
+// Returns the lower-cased title, possibly truncated if the original title
+// is overly-long.
+base::string16 CleanUpTitleForMatching(const base::string16& title);
+
} // namespace bookmark_utils
#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698