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 // |languages| is used to help parse IDNs in URLs for the bookmark index. | 33 // |index_urls| says whether URLs should be stored in the index in addition |
| 34 // to bookmark titles. |languages| used to help parse IDNs in URLs for the |
| 35 // bookmark index. |
34 BookmarkIndex(BookmarkClient* client, | 36 BookmarkIndex(BookmarkClient* client, |
| 37 bool index_urls, |
35 const std::string& languages); | 38 const std::string& languages); |
36 ~BookmarkIndex(); | 39 ~BookmarkIndex(); |
37 | 40 |
38 // Invoked when a bookmark has been added to the model. | 41 // Invoked when a bookmark has been added to the model. |
39 void Add(const BookmarkNode* node); | 42 void Add(const BookmarkNode* node); |
40 | 43 |
41 // Invoked when a bookmark has been removed from the model. | 44 // Invoked when a bookmark has been removed from the model. |
42 void Remove(const BookmarkNode* node); | 45 void Remove(const BookmarkNode* node); |
43 | 46 |
44 // Returns up to |max_count| of bookmarks containing each term from | 47 // Returns up to |max_count| of bookmarks containing each term from |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Removes |node| from |index_|. | 107 // Removes |node| from |index_|. |
105 void UnregisterNode(const base::string16& term, const BookmarkNode* node); | 108 void UnregisterNode(const base::string16& term, const BookmarkNode* node); |
106 | 109 |
107 Index index_; | 110 Index index_; |
108 | 111 |
109 BookmarkClient* const client_; | 112 BookmarkClient* const client_; |
110 | 113 |
111 // Languages used to help parse IDNs in URLs for the bookmark index. | 114 // Languages used to help parse IDNs in URLs for the bookmark index. |
112 const std::string languages_; | 115 const std::string languages_; |
113 | 116 |
| 117 // True if URLs are stored in the index as well as bookmark titles. |
| 118 const bool index_urls_; |
| 119 |
114 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); | 120 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); |
115 }; | 121 }; |
116 | 122 |
117 } // namespace bookmarks | 123 } // namespace bookmarks |
118 | 124 |
119 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ | 125 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ |
OLD | NEW |