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 <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // | 59 // |
60 // You should NOT directly create a BookmarkModel, instead go through the | 60 // You should NOT directly create a BookmarkModel, instead go through the |
61 // BookmarkModelFactory. | 61 // BookmarkModelFactory. |
62 class BookmarkModel : public KeyedService { | 62 class BookmarkModel : public KeyedService { |
63 public: | 63 public: |
64 struct URLAndTitle { | 64 struct URLAndTitle { |
65 GURL url; | 65 GURL url; |
66 base::string16 title; | 66 base::string16 title; |
67 }; | 67 }; |
68 | 68 |
69 explicit BookmarkModel(bookmarks::BookmarkClient* client); | 69 // |index_urls| says whether URLs should be stored in the BookmarkIndex |
| 70 // in addition to bookmark titles. |
| 71 BookmarkModel(bookmarks::BookmarkClient* client, bool index_urls); |
70 virtual ~BookmarkModel(); | 72 virtual ~BookmarkModel(); |
71 | 73 |
72 // KeyedService: | 74 // KeyedService: |
73 virtual void Shutdown() OVERRIDE; | 75 virtual void Shutdown() OVERRIDE; |
74 | 76 |
75 // Loads the bookmarks. This is called upon creation of the | 77 // Loads the bookmarks. This is called upon creation of the |
76 // BookmarkModel. You need not invoke this directly. | 78 // BookmarkModel. You need not invoke this directly. |
77 // All load operations will be executed on |io_task_runner| and the completion | 79 // All load operations will be executed on |io_task_runner| and the completion |
78 // callback will be called from |ui_task_runner|. | 80 // callback will be called from |ui_task_runner|. |
79 void Load(PrefService* pref_service, | 81 void Load(PrefService* pref_service, |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 base::Lock url_lock_; | 408 base::Lock url_lock_; |
407 | 409 |
408 // Used for loading favicons. | 410 // Used for loading favicons. |
409 base::CancelableTaskTracker cancelable_task_tracker_; | 411 base::CancelableTaskTracker cancelable_task_tracker_; |
410 | 412 |
411 // Reads/writes bookmarks to disk. | 413 // Reads/writes bookmarks to disk. |
412 scoped_ptr<bookmarks::BookmarkStorage> store_; | 414 scoped_ptr<bookmarks::BookmarkStorage> store_; |
413 | 415 |
414 scoped_ptr<bookmarks::BookmarkIndex> index_; | 416 scoped_ptr<bookmarks::BookmarkIndex> index_; |
415 | 417 |
| 418 // True if URLs are stored in the BookmarkIndex in addition to bookmark |
| 419 // titles. |
| 420 const bool index_urls_; |
| 421 |
416 base::WaitableEvent loaded_signal_; | 422 base::WaitableEvent loaded_signal_; |
417 | 423 |
418 // See description of IsDoingExtensiveChanges above. | 424 // See description of IsDoingExtensiveChanges above. |
419 int extensive_changes_; | 425 int extensive_changes_; |
420 | 426 |
421 scoped_ptr<bookmarks::BookmarkExpandedStateTracker> expanded_state_tracker_; | 427 scoped_ptr<bookmarks::BookmarkExpandedStateTracker> expanded_state_tracker_; |
422 | 428 |
423 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 429 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
424 }; | 430 }; |
425 | 431 |
426 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ | 432 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ |
OLD | NEW |