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_MODEL_H_ | 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ |
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ | 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 namespace query_parser { | 41 namespace query_parser { |
42 enum class MatchingAlgorithm; | 42 enum class MatchingAlgorithm; |
43 } | 43 } |
44 | 44 |
45 namespace bookmarks { | 45 namespace bookmarks { |
46 | 46 |
47 class BookmarkCodecTest; | 47 class BookmarkCodecTest; |
48 class BookmarkExpandedStateTracker; | 48 class BookmarkExpandedStateTracker; |
49 class BookmarkIndex; | |
50 class BookmarkLoadDetails; | 49 class BookmarkLoadDetails; |
51 class BookmarkModelObserver; | 50 class BookmarkModelObserver; |
52 class BookmarkStorage; | 51 class BookmarkStorage; |
53 class BookmarkUndoDelegate; | 52 class BookmarkUndoDelegate; |
54 class ScopedGroupBookmarkActions; | 53 class ScopedGroupBookmarkActions; |
55 class TestBookmarkClient; | 54 class TestBookmarkClient; |
56 struct BookmarkMatch; | 55 class TitledUrlIndex; |
| 56 struct TitledUrlMatch; |
57 | 57 |
58 // BookmarkModel -------------------------------------------------------------- | 58 // BookmarkModel -------------------------------------------------------------- |
59 | 59 |
60 // BookmarkModel provides a directed acyclic graph of URLs and folders. | 60 // BookmarkModel provides a directed acyclic graph of URLs and folders. |
61 // Three graphs are provided for the three entry points: those on the 'bookmarks | 61 // Three graphs are provided for the three entry points: those on the 'bookmarks |
62 // bar', those in the 'other bookmarks' folder and those in the 'mobile' folder. | 62 // bar', those in the 'other bookmarks' folder and those in the 'mobile' folder. |
63 // | 63 // |
64 // An observer may be attached to observe relevant events. | 64 // An observer may be attached to observe relevant events. |
65 // | 65 // |
66 // You should NOT directly create a BookmarkModel, instead go through the | 66 // You should NOT directly create a BookmarkModel, instead go through the |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 // Resets the 'date modified' time of the node to 0. This is used during | 237 // Resets the 'date modified' time of the node to 0. This is used during |
238 // importing to exclude the newly created folders from showing up in the | 238 // importing to exclude the newly created folders from showing up in the |
239 // combobox of most recently modified folders. | 239 // combobox of most recently modified folders. |
240 void ResetDateFolderModified(const BookmarkNode* node); | 240 void ResetDateFolderModified(const BookmarkNode* node); |
241 | 241 |
242 // Returns up to |max_count| of bookmarks containing each term from |text| | 242 // Returns up to |max_count| of bookmarks containing each term from |text| |
243 // in either the title or the URL. It uses default matching algorithm. | 243 // in either the title or the URL. It uses default matching algorithm. |
244 void GetBookmarksMatching(const base::string16& text, | 244 void GetBookmarksMatching(const base::string16& text, |
245 size_t max_count, | 245 size_t max_count, |
246 std::vector<BookmarkMatch>* matches); | 246 std::vector<TitledUrlMatch>* matches); |
247 | 247 |
248 // Returns up to |max_count| of bookmarks containing each term from |text| | 248 // Returns up to |max_count| of bookmarks containing each term from |text| |
249 // in either the title or the URL. | 249 // in either the title or the URL. |
250 void GetBookmarksMatching(const base::string16& text, | 250 void GetBookmarksMatching(const base::string16& text, |
251 size_t max_count, | 251 size_t max_count, |
252 query_parser::MatchingAlgorithm matching_algorithm, | 252 query_parser::MatchingAlgorithm matching_algorithm, |
253 std::vector<BookmarkMatch>* matches); | 253 std::vector<TitledUrlMatch>* matches); |
254 | 254 |
255 // Sets the store to NULL, making it so the BookmarkModel does not persist | 255 // Sets the store to NULL, making it so the BookmarkModel does not persist |
256 // any changes to disk. This is only useful during testing to speed up | 256 // any changes to disk. This is only useful during testing to speed up |
257 // testing. | 257 // testing. |
258 void ClearStore(); | 258 void ClearStore(); |
259 | 259 |
260 // Returns the next node ID. | 260 // Returns the next node ID. |
261 int64_t next_node_id() const { return next_node_id_; } | 261 int64_t next_node_id() const { return next_node_id_; } |
262 | 262 |
263 // Returns the object responsible for tracking the set of expanded nodes in | 263 // Returns the object responsible for tracking the set of expanded nodes in |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 typedef std::multiset<BookmarkNode*, NodeURLComparator> NodesOrderedByURLSet; | 443 typedef std::multiset<BookmarkNode*, NodeURLComparator> NodesOrderedByURLSet; |
444 NodesOrderedByURLSet nodes_ordered_by_url_set_; | 444 NodesOrderedByURLSet nodes_ordered_by_url_set_; |
445 base::Lock url_lock_; | 445 base::Lock url_lock_; |
446 | 446 |
447 // Used for loading favicons. | 447 // Used for loading favicons. |
448 base::CancelableTaskTracker cancelable_task_tracker_; | 448 base::CancelableTaskTracker cancelable_task_tracker_; |
449 | 449 |
450 // Reads/writes bookmarks to disk. | 450 // Reads/writes bookmarks to disk. |
451 std::unique_ptr<BookmarkStorage> store_; | 451 std::unique_ptr<BookmarkStorage> store_; |
452 | 452 |
453 std::unique_ptr<BookmarkIndex> index_; | 453 std::unique_ptr<TitledUrlIndex> index_; |
454 | 454 |
455 base::WaitableEvent loaded_signal_; | 455 base::WaitableEvent loaded_signal_; |
456 | 456 |
457 // See description of IsDoingExtensiveChanges above. | 457 // See description of IsDoingExtensiveChanges above. |
458 int extensive_changes_; | 458 int extensive_changes_; |
459 | 459 |
460 std::unique_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; | 460 std::unique_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_; |
461 | 461 |
462 std::set<std::string> non_cloned_keys_; | 462 std::set<std::string> non_cloned_keys_; |
463 | 463 |
464 BookmarkUndoDelegate* undo_delegate_; | 464 BookmarkUndoDelegate* undo_delegate_; |
465 std::unique_ptr<BookmarkUndoDelegate> empty_undo_delegate_; | 465 std::unique_ptr<BookmarkUndoDelegate> empty_undo_delegate_; |
466 | 466 |
467 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 467 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
468 }; | 468 }; |
469 | 469 |
470 } // namespace bookmarks | 470 } // namespace bookmarks |
471 | 471 |
472 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ | 472 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ |
OLD | NEW |