| 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_TITLED_URL_INDEX_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_INDEX_H_ |
| 6 #define COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_INDEX_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_INDEX_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class TitledUrlNodeSorter; | 22 class TitledUrlNodeSorter; |
| 23 struct TitledUrlMatch; | 23 struct TitledUrlMatch; |
| 24 | 24 |
| 25 // TitledUrlIndex maintains an index of paired titles and URLs for quick lookup. | 25 // TitledUrlIndex maintains an index of paired titles and URLs for quick lookup. |
| 26 // | 26 // |
| 27 // TitledUrlIndex maintains the index (index_) as a map of sets. The map (type | 27 // TitledUrlIndex maintains the index (index_) as a map of sets. The map (type |
| 28 // Index) maps from a lower case string to the set (type TitledUrlNodeSet) of | 28 // Index) maps from a lower case string to the set (type TitledUrlNodeSet) of |
| 29 // TitledUrlNodes that contain that string in their title or URL. | 29 // TitledUrlNodes that contain that string in their title or URL. |
| 30 class TitledUrlIndex { | 30 class TitledUrlIndex { |
| 31 public: | 31 public: |
| 32 // Constructs a TitledUrlIndex. |sorter| is used to construct a sorted list |
| 33 // of matches when matches are returned from the index. If null, matches are |
| 34 // returned unsorted. |
| 32 TitledUrlIndex(std::unique_ptr<TitledUrlNodeSorter> sorter); | 35 TitledUrlIndex(std::unique_ptr<TitledUrlNodeSorter> sorter); |
| 33 ~TitledUrlIndex(); | 36 ~TitledUrlIndex(); |
| 34 | 37 |
| 35 // Invoked when a title/URL pair has been added to the model. | 38 // Invoked when a title/URL pair has been added to the model. |
| 36 void Add(const TitledUrlNode* node); | 39 void Add(const TitledUrlNode* node); |
| 37 | 40 |
| 38 // Invoked when a title/URL pair has been removed from the model. | 41 // Invoked when a title/URL pair has been removed from the model. |
| 39 void Remove(const TitledUrlNode* node); | 42 void Remove(const TitledUrlNode* node); |
| 40 | 43 |
| 41 // Returns up to |max_count| of matches containing each term from the text | 44 // Returns up to |max_count| of matches containing each term from the text |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 Index index_; | 85 Index index_; |
| 83 | 86 |
| 84 std::unique_ptr<TitledUrlNodeSorter> sorter_; | 87 std::unique_ptr<TitledUrlNodeSorter> sorter_; |
| 85 | 88 |
| 86 DISALLOW_COPY_AND_ASSIGN(TitledUrlIndex); | 89 DISALLOW_COPY_AND_ASSIGN(TitledUrlIndex); |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 } // namespace bookmarks | 92 } // namespace bookmarks |
| 90 | 93 |
| 91 #endif // COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_INDEX_H_ | 94 #endif // COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_INDEX_H_ |
| OLD | NEW |