Chromium Code Reviews| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/strings/string16.h" | 20 #include "base/strings/string16.h" |
| 21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 22 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
| 23 #include "components/bookmarks/browser/bookmark_client.h" | 23 #include "components/bookmarks/browser/bookmark_client.h" |
| 24 #include "components/bookmarks/browser/bookmark_node.h" | 24 #include "components/bookmarks/browser/bookmark_node.h" |
| 25 #include "components/bookmarks/browser/bookmark_undo_provider.h" | 25 #include "components/bookmarks/browser/bookmark_undo_provider.h" |
| 26 #include "components/keyed_service/core/keyed_service.h" | 26 #include "components/keyed_service/core/keyed_service.h" |
| 27 #include "components/offline_pages/external_listener.h" | |
| 27 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| 28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 29 | 30 |
| 30 class PrefService; | 31 class PrefService; |
| 31 | 32 |
| 32 namespace base { | 33 namespace base { |
| 33 class FilePath; | 34 class FilePath; |
| 34 class SequencedTaskRunner; | 35 class SequencedTaskRunner; |
| 35 } | 36 } |
| 36 | 37 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 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 explicit BookmarkModel( |
|
Dmitry Titov
2016/08/12 05:43:43
when ctor takes more then one arg, it should not b
romax
2016/08/16 19:05:44
Done.
| |
| 78 std::unique_ptr<BookmarkClient> client, | |
| 79 std::unique_ptr<offline_pages::ExternalListener> offline_page_listener); | |
| 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<offline_pages::ExternalListener> offline_page_listener_; | |
| 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 |