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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // BookmarkIndex maintains an index of the titles and URLs of bookmarks for | 25 // BookmarkIndex maintains an index of the titles and URLs of bookmarks for |
26 // quick look up. BookmarkIndex is owned and maintained by BookmarkModel, you | 26 // quick look up. BookmarkIndex is owned and maintained by BookmarkModel, you |
27 // shouldn't need to interact directly with BookmarkIndex. | 27 // shouldn't need to interact directly with BookmarkIndex. |
28 // | 28 // |
29 // BookmarkIndex maintains the index (index_) as a map of sets. The map (type | 29 // BookmarkIndex maintains the index (index_) as a map of sets. The map (type |
30 // Index) maps from a lower case string to the set (type NodeSet) of | 30 // Index) maps from a lower case string to the set (type NodeSet) of |
31 // BookmarkNodes that contain that string in their title or URL. | 31 // BookmarkNodes that contain that string in their title or URL. |
32 class BookmarkIndex { | 32 class BookmarkIndex { |
33 public: | 33 public: |
34 // |languages| is used to help parse IDNs in URLs for the bookmark index. | 34 BookmarkIndex(BookmarkClient* client); |
35 BookmarkIndex(BookmarkClient* client, | |
36 const std::string& languages); | |
37 ~BookmarkIndex(); | 35 ~BookmarkIndex(); |
38 | 36 |
39 // Invoked when a bookmark has been added to the model. | 37 // Invoked when a bookmark has been added to the model. |
40 void Add(const BookmarkNode* node); | 38 void Add(const BookmarkNode* node); |
41 | 39 |
42 // Invoked when a bookmark has been removed from the model. | 40 // Invoked when a bookmark has been removed from the model. |
43 void Remove(const BookmarkNode* node); | 41 void Remove(const BookmarkNode* node); |
44 | 42 |
45 // Returns up to |max_count| of bookmarks containing each term from the text | 43 // Returns up to |max_count| of bookmarks containing each term from the text |
46 // |query| in either the title or the URL. | 44 // |query| in either the title or the URL. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Adds |node| to |index_|. | 79 // Adds |node| to |index_|. |
82 void RegisterNode(const base::string16& term, const BookmarkNode* node); | 80 void RegisterNode(const base::string16& term, const BookmarkNode* node); |
83 | 81 |
84 // Removes |node| from |index_|. | 82 // Removes |node| from |index_|. |
85 void UnregisterNode(const base::string16& term, const BookmarkNode* node); | 83 void UnregisterNode(const base::string16& term, const BookmarkNode* node); |
86 | 84 |
87 Index index_; | 85 Index index_; |
88 | 86 |
89 BookmarkClient* const client_; | 87 BookmarkClient* const client_; |
90 | 88 |
91 // Languages used to help parse IDNs in URLs for the bookmark index. | |
92 const std::string languages_; | |
93 | |
94 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); | 89 DISALLOW_COPY_AND_ASSIGN(BookmarkIndex); |
95 }; | 90 }; |
96 | 91 |
97 } // namespace bookmarks | 92 } // namespace bookmarks |
98 | 93 |
99 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ | 94 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_INDEX_H_ |
OLD | NEW |