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

Side by Side Diff: chrome/browser/bookmarks/bookmark_index.h

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_INDEX_H_ 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_INDEX_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_INDEX_H_ 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_INDEX_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 27 matching lines...) Expand all
38 ~BookmarkIndex(); 38 ~BookmarkIndex();
39 39
40 // Invoked when a bookmark has been added to the model. 40 // Invoked when a bookmark has been added to the model.
41 void Add(const BookmarkNode* node); 41 void Add(const BookmarkNode* node);
42 42
43 // Invoked when a bookmark has been removed from the model. 43 // Invoked when a bookmark has been removed from the model.
44 void Remove(const BookmarkNode* node); 44 void Remove(const BookmarkNode* node);
45 45
46 // Returns up to |max_count| of bookmarks containing the text |query|. 46 // Returns up to |max_count| of bookmarks containing the text |query|.
47 void GetBookmarksWithTitlesMatching( 47 void GetBookmarksWithTitlesMatching(
48 const string16& query, 48 const base::string16& query,
49 size_t max_count, 49 size_t max_count,
50 std::vector<BookmarkTitleMatch>* results); 50 std::vector<BookmarkTitleMatch>* results);
51 51
52 private: 52 private:
53 typedef std::set<const BookmarkNode*> NodeSet; 53 typedef std::set<const BookmarkNode*> NodeSet;
54 typedef std::map<string16, NodeSet> Index; 54 typedef std::map<string16, NodeSet> Index;
55 55
56 struct Match; 56 struct Match;
57 typedef std::vector<Match> Matches; 57 typedef std::vector<Match> Matches;
58 58
(...skipping 24 matching lines...) Expand all
83 83
84 // Add |node| to |results| if the node matches the query. 84 // Add |node| to |results| if the node matches the query.
85 void AddMatchToResults(const BookmarkNode* node, 85 void AddMatchToResults(const BookmarkNode* node,
86 QueryParser* parser, 86 QueryParser* parser,
87 const std::vector<QueryNode*>& query_nodes, 87 const std::vector<QueryNode*>& query_nodes,
88 std::vector<BookmarkTitleMatch>* results); 88 std::vector<BookmarkTitleMatch>* results);
89 89
90 // Populates |matches| for the specified term. If |first_term| is true, this 90 // Populates |matches| for the specified term. If |first_term| is true, this
91 // is the first term in the query. Returns true if there is at least one node 91 // is the first term in the query. Returns true if there is at least one node
92 // matching the term. 92 // matching the term.
93 bool GetBookmarksWithTitleMatchingTerm(const string16& term, 93 bool GetBookmarksWithTitleMatchingTerm(const base::string16& term,
94 bool first_term, 94 bool first_term,
95 Matches* matches); 95 Matches* matches);
96 96
97 // Iterates over |matches| updating each Match's nodes to contain the 97 // Iterates over |matches| updating each Match's nodes to contain the
98 // intersection of the Match's current nodes and the nodes at |index_i|. 98 // intersection of the Match's current nodes and the nodes at |index_i|.
99 // If the intersection is empty, the Match is removed. 99 // If the intersection is empty, the Match is removed.
100 // 100 //
101 // This is invoked from GetBookmarksWithTitleMatchingTerm. 101 // This is invoked from GetBookmarksWithTitleMatchingTerm.
102 void CombineMatchesInPlace(const Index::const_iterator& index_i, 102 void CombineMatchesInPlace(const Index::const_iterator& index_i,
103 Matches* matches); 103 Matches* matches);
104 104
105 // Iterates over |current_matches| calculating the intersection between the 105 // Iterates over |current_matches| calculating the intersection between the
106 // Match's nodes and the nodes at |index_i|. If the intersection between the 106 // Match's nodes and the nodes at |index_i|. If the intersection between the
107 // two is non-empty, a new match is added to |result|. 107 // two is non-empty, a new match is added to |result|.
108 // 108 //
109 // This differs from CombineMatchesInPlace in that if the intersection is 109 // This differs from CombineMatchesInPlace in that if the intersection is
110 // non-empty the result is added to result, not combined in place. This 110 // non-empty the result is added to result, not combined in place. This
111 // variant is used for prefix matching. 111 // variant is used for prefix matching.
112 // 112 //
113 // This is invoked from GetBookmarksWithTitleMatchingTerm. 113 // This is invoked from GetBookmarksWithTitleMatchingTerm.
114 void CombineMatches(const Index::const_iterator& index_i, 114 void CombineMatches(const Index::const_iterator& index_i,
115 const Matches& current_matches, 115 const Matches& current_matches,
116 Matches* result); 116 Matches* result);
117 117
118 // Returns the set of query words from |query|. 118 // Returns the set of query words from |query|.
119 std::vector<string16> ExtractQueryWords(const string16& query); 119 std::vector<string16> ExtractQueryWords(const base::string16& query);
120 120
121 // Adds |node| to |index_|. 121 // Adds |node| to |index_|.
122 void RegisterNode(const string16& term, const BookmarkNode* node); 122 void RegisterNode(const base::string16& term, const BookmarkNode* node);
123 123
124 // Removes |node| from |index_|. 124 // Removes |node| from |index_|.
125 void UnregisterNode(const string16& term, const BookmarkNode* node); 125 void UnregisterNode(const base::string16& term, const BookmarkNode* node);
126 126
127 Index index_; 127 Index index_;
128 128
129 content::BrowserContext* browser_context_; 129 content::BrowserContext* browser_context_;
130 130
131 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); 131 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex);
132 }; 132 };
133 133
134 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_INDEX_H_ 134 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_INDEX_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_html_writer_unittest.cc ('k') | chrome/browser/bookmarks/bookmark_index.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698