| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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; | 49 class BookmarkIndex; |
| 50 class BookmarkLoadDetails; | 50 class BookmarkLoadDetails; |
| 51 class BookmarkModelObserver; | 51 class BookmarkModelObserver; |
| 52 class BookmarkStorage; | 52 class BookmarkStorage; |
| 53 class BookmarkUndoDelegate; | 53 class BookmarkUndoDelegate; |
| 54 class OfflinePageBookmarkObserver; |
| 54 class ScopedGroupBookmarkActions; | 55 class ScopedGroupBookmarkActions; |
| 55 class TestBookmarkClient; | 56 class TestBookmarkClient; |
| 56 struct BookmarkMatch; | 57 struct BookmarkMatch; |
| 57 | 58 |
| 58 // BookmarkModel -------------------------------------------------------------- | 59 // BookmarkModel -------------------------------------------------------------- |
| 59 | 60 |
| 60 // BookmarkModel provides a directed acyclic graph of URLs and folders. | 61 // BookmarkModel provides a directed acyclic graph of URLs and folders. |
| 61 // Three graphs are provided for the three entry points: those on the 'bookmarks | 62 // 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. | 63 // bar', those in the 'other bookmarks' folder and those in the 'mobile' folder. |
| 63 // | 64 // |
| 64 // An observer may be attached to observe relevant events. | 65 // An observer may be attached to observe relevant events. |
| 65 // | 66 // |
| 66 // You should NOT directly create a BookmarkModel, instead go through the | 67 // You should NOT directly create a BookmarkModel, instead go through the |
| 67 // BookmarkModelFactory. | 68 // BookmarkModelFactory. |
| 68 class BookmarkModel : public BookmarkUndoProvider, | 69 class BookmarkModel : public BookmarkUndoProvider, |
| 69 public KeyedService { | 70 public KeyedService { |
| 70 public: | 71 public: |
| 71 struct URLAndTitle { | 72 struct URLAndTitle { |
| 72 GURL url; | 73 GURL url; |
| 73 base::string16 title; | 74 base::string16 title; |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 explicit BookmarkModel(std::unique_ptr<BookmarkClient> client); | 77 BookmarkModel( |
| 78 std::unique_ptr<BookmarkClient> client, |
| 79 std::unique_ptr<OfflinePageBookmarkObserver> offline_page_observer); |
| 77 ~BookmarkModel() override; | 80 ~BookmarkModel() override; |
| 78 | 81 |
| 79 // KeyedService: | 82 // KeyedService: |
| 80 void Shutdown() override; | 83 void Shutdown() override; |
| 81 | 84 |
| 82 // Loads the bookmarks. This is called upon creation of the | 85 // Loads the bookmarks. This is called upon creation of the |
| 83 // BookmarkModel. You need not invoke this directly. | 86 // BookmarkModel. You need not invoke this directly. |
| 84 // All load operations will be executed on |io_task_runner| and the completion | 87 // All load operations will be executed on |io_task_runner| and the completion |
| 85 // callback will be called from |ui_task_runner|. | 88 // callback will be called from |ui_task_runner|. |
| 86 void Load(PrefService* pref_service, | 89 void Load(PrefService* pref_service, |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 void set_next_node_id(int64_t id) { next_node_id_ = id; } | 418 void set_next_node_id(int64_t id) { next_node_id_ = id; } |
| 416 | 419 |
| 417 // Creates and returns a new BookmarkLoadDetails. It's up to the caller to | 420 // Creates and returns a new BookmarkLoadDetails. It's up to the caller to |
| 418 // delete the returned object. | 421 // delete the returned object. |
| 419 std::unique_ptr<BookmarkLoadDetails> CreateLoadDetails(); | 422 std::unique_ptr<BookmarkLoadDetails> CreateLoadDetails(); |
| 420 | 423 |
| 421 BookmarkUndoDelegate* undo_delegate() const; | 424 BookmarkUndoDelegate* undo_delegate() const; |
| 422 | 425 |
| 423 std::unique_ptr<BookmarkClient> client_; | 426 std::unique_ptr<BookmarkClient> client_; |
| 424 | 427 |
| 428 std::unique_ptr<OfflinePageBookmarkObserver> offline_page_observer_; |
| 429 |
| 425 // Whether the initial set of data has been loaded. | 430 // Whether the initial set of data has been loaded. |
| 426 bool loaded_; | 431 bool loaded_; |
| 427 | 432 |
| 428 // The root node. This contains the bookmark bar node, the 'other' node and | 433 // The root node. This contains the bookmark bar node, the 'other' node and |
| 429 // the mobile node as children. | 434 // the mobile node as children. |
| 430 BookmarkNode root_; | 435 BookmarkNode root_; |
| 431 | 436 |
| 432 BookmarkPermanentNode* bookmark_bar_node_; | 437 BookmarkPermanentNode* bookmark_bar_node_; |
| 433 BookmarkPermanentNode* other_node_; | 438 BookmarkPermanentNode* other_node_; |
| 434 BookmarkPermanentNode* mobile_node_; | 439 BookmarkPermanentNode* mobile_node_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 471 |
| 467 BookmarkUndoDelegate* undo_delegate_; | 472 BookmarkUndoDelegate* undo_delegate_; |
| 468 std::unique_ptr<BookmarkUndoDelegate> empty_undo_delegate_; | 473 std::unique_ptr<BookmarkUndoDelegate> empty_undo_delegate_; |
| 469 | 474 |
| 470 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 475 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
| 471 }; | 476 }; |
| 472 | 477 |
| 473 } // namespace bookmarks | 478 } // namespace bookmarks |
| 474 | 479 |
| 475 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ | 480 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ |
| OLD | NEW |