| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // This does NOT delete the node. | 347 // This does NOT delete the node. |
| 348 void RemoveNode(BookmarkNode* node, std::set<GURL>* removed_urls); | 348 void RemoveNode(BookmarkNode* node, std::set<GURL>* removed_urls); |
| 349 | 349 |
| 350 // Invoked when loading is finished. Sets |loaded_| and notifies observers. | 350 // Invoked when loading is finished. Sets |loaded_| and notifies observers. |
| 351 // BookmarkModel takes ownership of |details|. | 351 // BookmarkModel takes ownership of |details|. |
| 352 void DoneLoading(std::unique_ptr<BookmarkLoadDetails> details); | 352 void DoneLoading(std::unique_ptr<BookmarkLoadDetails> details); |
| 353 | 353 |
| 354 // Populates |nodes_ordered_by_url_set_| from root. | 354 // Populates |nodes_ordered_by_url_set_| from root. |
| 355 void PopulateNodesByURL(BookmarkNode* node); | 355 void PopulateNodesByURL(BookmarkNode* node); |
| 356 | 356 |
| 357 // Removes the node from its parent, but does not delete it. No notifications | 357 // Removes the node from its parent and returns it. No notifications |
| 358 // are sent. |removed_urls| is populated with the urls which no longer have | 358 // are sent. |removed_urls| is populated with the urls which no longer have |
| 359 // any bookmarks associated with them. | 359 // any bookmarks associated with them. |
| 360 // This method should be called after acquiring |url_lock_|. | 360 // This method should be called after acquiring |url_lock_|. |
| 361 void RemoveNodeAndGetRemovedUrls(BookmarkNode* node, | 361 std::unique_ptr<BookmarkNode> RemoveNodeAndGetRemovedUrls( |
| 362 std::set<GURL>* removed_urls); | 362 BookmarkNode* node, |
| 363 std::set<GURL>* removed_urls); |
| 363 | 364 |
| 364 // Removes the node from its parent, sends notification, and deletes it. | 365 // Removes the node from its parent, sends notification, and deletes it. |
| 365 // type specifies how the node should be removed. | 366 // type specifies how the node should be removed. |
| 366 void RemoveAndDeleteNode(BookmarkNode* delete_me); | 367 void RemoveAndDeleteNode(BookmarkNode* delete_me); |
| 367 | 368 |
| 368 // Remove |node| from |nodes_ordered_by_url_set_| and |index_|. | 369 // Remove |node| from |nodes_ordered_by_url_set_| and |index_|. |
| 369 void RemoveNodeFromInternalMaps(BookmarkNode* node); | 370 void RemoveNodeFromInternalMaps(BookmarkNode* node); |
| 370 | 371 |
| 371 // Adds the |node| at |parent| in the specified |index| and notifies its | 372 // Adds the |node| at |parent| in the specified |index| and notifies its |
| 372 // observers. | 373 // observers. |
| 373 BookmarkNode* AddNode(BookmarkNode* parent, | 374 BookmarkNode* AddNode(BookmarkNode* parent, |
| 374 int index, | 375 int index, |
| 375 BookmarkNode* node); | 376 std::unique_ptr<BookmarkNode> node); |
| 376 | 377 |
| 377 // Adds the |node| to |nodes_ordered_by_url_set_| and |index_|. | 378 // Adds the |node| to |nodes_ordered_by_url_set_| and |index_|. |
| 378 void AddNodeToInternalMaps(BookmarkNode* node); | 379 void AddNodeToInternalMaps(BookmarkNode* node); |
| 379 | 380 |
| 380 // Returns true if the parent and index are valid. | 381 // Returns true if the parent and index are valid. |
| 381 bool IsValidIndex(const BookmarkNode* parent, int index, bool allow_end); | 382 bool IsValidIndex(const BookmarkNode* parent, int index, bool allow_end); |
| 382 | 383 |
| 383 // Creates one of the possible permanent nodes (bookmark bar node, other node | 384 // Creates one of the possible permanent nodes (bookmark bar node, other node |
| 384 // and mobile node) from |type|. | 385 // and mobile node) from |type|. |
| 385 BookmarkPermanentNode* CreatePermanentNode(BookmarkNode::Type type); | 386 BookmarkPermanentNode* CreatePermanentNode(BookmarkNode::Type type); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 467 |
| 467 BookmarkUndoDelegate* undo_delegate_; | 468 BookmarkUndoDelegate* undo_delegate_; |
| 468 std::unique_ptr<BookmarkUndoDelegate> empty_undo_delegate_; | 469 std::unique_ptr<BookmarkUndoDelegate> empty_undo_delegate_; |
| 469 | 470 |
| 470 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); | 471 DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
| 471 }; | 472 }; |
| 472 | 473 |
| 473 } // namespace bookmarks | 474 } // namespace bookmarks |
| 474 | 475 |
| 475 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ | 476 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_H_ |
| OLD | NEW |