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

Side by Side 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: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "chrome/browser/bookmarks/bookmark_node_data.h" 12 #include "chrome/browser/bookmarks/bookmark_node_data.h"
13 13
14 class BookmarkModel; 14 class BookmarkModel;
15 class BookmarkNode; 15 class BookmarkNode;
16 class GURL;
16 17
17 namespace user_prefs { 18 namespace user_prefs {
18 class PrefRegistrySyncable; 19 class PrefRegistrySyncable;
19 } 20 }
20 21
21 // A collection of bookmark utility functions used by various parts of the UI 22 // A collection of bookmark utility functions used by various parts of the UI
22 // that show bookmarks: bookmark manager, bookmark bar view ... 23 // that show bookmarks (bookmark manager, bookmark bar view, ...) and other
24 // system that involve indexing and searching bookmarks.
23 namespace bookmark_utils { 25 namespace bookmark_utils {
24 26
25 // Fields to use when finding matching bookmarks. 27 // Fields to use when finding matching bookmarks.
26 struct QueryFields { 28 struct QueryFields {
27 QueryFields(); 29 QueryFields();
28 ~QueryFields(); 30 ~QueryFields();
29 31
30 scoped_ptr<base::string16> word_phrase_query; 32 scoped_ptr<base::string16> word_phrase_query;
31 scoped_ptr<base::string16> url; 33 scoped_ptr<base::string16> url;
32 scoped_ptr<base::string16> title; 34 scoped_ptr<base::string16> title;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 void DeleteBookmarkFolders(BookmarkModel* model, const std::vector<int64>& ids); 101 void DeleteBookmarkFolders(BookmarkModel* model, const std::vector<int64>& ids);
100 102
101 // If there are no bookmarks for url, a bookmark is created. 103 // If there are no bookmarks for url, a bookmark is created.
102 void AddIfNotBookmarked(BookmarkModel* model, 104 void AddIfNotBookmarked(BookmarkModel* model,
103 const GURL& url, 105 const GURL& url,
104 const base::string16& title); 106 const base::string16& title);
105 107
106 // Removes all bookmarks for the given |url|. 108 // Removes all bookmarks for the given |url|.
107 void RemoveAllBookmarks(BookmarkModel* model, const GURL& url); 109 void RemoveAllBookmarks(BookmarkModel* model, const GURL& url);
108 110
111 // Truncates an overly-long URL, unescapes it, and lower-cases it,
Mark P 2014/02/28 15:48:03 this is a simple move of these functions from the
112 // returning the result. This unescaping makes it possible to match
113 // substrings that were originally escaped for navigation; for
114 // example, if the user searched for "a&p", the query would be escaped
115 // as "a%26p", so without unescaping, an input string of "a&p" would
116 // no longer match this URL. Note that the resulting unescaped URL
117 // may not be directly navigable (which is why we escaped it to begin
118 // with). |languages| is passed to net::FormatUrl().
119 base::string16 CleanUpUrlForMatching(const GURL& gurl,
120 const std::string& languages);
121
122 // Returns the lower-cased title, possibly truncated if the original title
123 // is overly-long.
124 base::string16 CleanUpTitleForMatching(const base::string16& title);
125
109 } // namespace bookmark_utils 126 } // namespace bookmark_utils
110 127
111 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_ 128 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698