OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ |
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // BookmarkIndex maintains an index of the titles and URLs of bookmarks for | 24 // BookmarkIndex maintains an index of the titles and URLs of bookmarks for |
25 // quick look up. BookmarkIndex is owned and maintained by BookmarkModel, you | 25 // quick look up. BookmarkIndex is owned and maintained by BookmarkModel, you |
26 // shouldn't need to interact directly with BookmarkIndex. | 26 // shouldn't need to interact directly with BookmarkIndex. |
27 // | 27 // |
28 // BookmarkIndex maintains the index (index_) as a map of sets. The map (type | 28 // BookmarkIndex maintains the index (index_) as a map of sets. The map (type |
29 // Index) maps from a lower case string to the set (type NodeSet) of | 29 // Index) maps from a lower case string to the set (type NodeSet) of |
30 // BookmarkNodes that contain that string in their title or URL. | 30 // BookmarkNodes that contain that string in their title or URL. |
31 class BookmarkIndex { | 31 class BookmarkIndex { |
32 public: | 32 public: |
33 // |index_urls| says whether URLs should be stored in the index in addition | 33 // |languages| is used to help parse IDNs in URLs for the bookmark index. |
34 // to bookmark titles. |languages| used to help parse IDNs in URLs for the | |
35 // bookmark index. | |
36 BookmarkIndex(BookmarkClient* client, | 34 BookmarkIndex(BookmarkClient* client, |
37 bool index_urls, | |
38 const std::string& languages); | 35 const std::string& languages); |
39 ~BookmarkIndex(); | 36 ~BookmarkIndex(); |
40 | 37 |
41 // Invoked when a bookmark has been added to the model. | 38 // Invoked when a bookmark has been added to the model. |
42 void Add(const BookmarkNode* node); | 39 void Add(const BookmarkNode* node); |
43 | 40 |
44 // Invoked when a bookmark has been removed from the model. | 41 // Invoked when a bookmark has been removed from the model. |
45 void Remove(const BookmarkNode* node); | 42 void Remove(const BookmarkNode* node); |
46 | 43 |
47 // Returns up to |max_count| of bookmarks containing each term from | 44 // Returns up to |max_count| of bookmarks containing each term from |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Removes |node| from |index_|. | 104 // Removes |node| from |index_|. |
108 void UnregisterNode(const base::string16& term, const BookmarkNode* node); | 105 void UnregisterNode(const base::string16& term, const BookmarkNode* node); |
109 | 106 |
110 Index index_; | 107 Index index_; |
111 | 108 |
112 BookmarkClient* const client_; | 109 BookmarkClient* const client_; |
113 | 110 |
114 // Languages used to help parse IDNs in URLs for the bookmark index. | 111 // Languages used to help parse IDNs in URLs for the bookmark index. |
115 const std::string languages_; | 112 const std::string languages_; |
116 | 113 |
117 // True if URLs are stored in the index as well as bookmark titles. | |
118 const bool index_urls_; | |
119 | |
120 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); | 114 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); |
121 }; | 115 }; |
122 | 116 |
123 } // namespace bookmarks | 117 } // namespace bookmarks |
124 | 118 |
125 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ | 119 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ |
OLD | NEW |