Index: components/bookmarks/browser/bookmark_model.h |
diff --git a/components/bookmarks/browser/bookmark_model.h b/components/bookmarks/browser/bookmark_model.h |
index 27837703d0adc6719ef330fb483cd6afe1d1bcb7..6f1a57a7c60848905b40e3e2256a8ca6dd08a524 100644 |
--- a/components/bookmarks/browser/bookmark_model.h |
+++ b/components/bookmarks/browser/bookmark_model.h |
@@ -68,6 +68,20 @@ class BookmarkModel : public KeyedService { |
base::string16 title; |
}; |
+ class UndoDelegate { |
sky
2015/10/07 16:30:15
Move into it's own header (see chromium specific s
jianli
2015/10/07 23:26:55
Done.
|
+ public: |
+ // Called when a bookmark node was deleted. The delegate takes the ownership |
+ // of the deleted node. |
+ // |
+ // |parent_node_id| the id of the parent of the node that will be removed. |
+ // |index| the index of the node about to be removed in |parent|. |
+ // |node| is the node to be deleted. |
+ virtual void OnBookmarkNodeDeleted(BookmarkModel* model, |
+ int64_t parent_node_id, |
sky
2015/10/07 16:30:15
I would rather supply the BoomarkNode as the paren
jianli
2015/10/07 23:26:55
Done.
|
+ int index, |
+ BookmarkNode* node) = 0; |
sky
2015/10/07 16:30:15
Use scoped_ptr to clarify ownership.
jianli
2015/10/07 23:26:55
Done.
|
+ }; |
+ |
explicit BookmarkModel(BookmarkClient* client); |
~BookmarkModel() override; |
@@ -220,6 +234,12 @@ class BookmarkModel : public KeyedService { |
const base::Time& creation_time, |
const BookmarkNode::MetaInfoMap* meta_info); |
+ // Adds the |node| at |parent| in the specified |index| and notifies its |
+ // observers. |
+ BookmarkNode* AddNode(BookmarkNode* parent, |
sky
2015/10/07 16:30:15
I don't want this to be public. Expose an interfac
jianli
2015/10/07 23:26:56
Done.
|
+ int index, |
+ BookmarkNode* node); |
+ |
// Sorts the children of |parent|, notifying observers by way of the |
// BookmarkNodeChildrenReordered method. |
void SortChildren(const BookmarkNode* parent); |
@@ -308,6 +328,10 @@ class BookmarkModel : public KeyedService { |
// Returns the client used by this BookmarkModel. |
BookmarkClient* client() const { return client_; } |
+ void set_undo_delegate(UndoDelegate* undo_delegate) { |
+ undo_delegate_ = undo_delegate; |
+ } |
+ |
private: |
friend class BookmarkCodecTest; |
friend class BookmarkModelFaviconTest; |
@@ -354,12 +378,6 @@ class BookmarkModel : public KeyedService { |
// Remove |node| from |nodes_ordered_by_url_set_| and |index_|. |
void RemoveNodeFromInternalMaps(BookmarkNode* node); |
- // Adds the |node| at |parent| in the specified |index| and notifies its |
- // observers. |
- BookmarkNode* AddNode(BookmarkNode* parent, |
- int index, |
- BookmarkNode* node); |
- |
// Adds the |node| to |nodes_ordered_by_url_set_| and |index_|. |
void AddNodeToInternalMaps(BookmarkNode* node); |
@@ -449,6 +467,8 @@ class BookmarkModel : public KeyedService { |
std::set<std::string> non_cloned_keys_; |
+ UndoDelegate* undo_delegate_; |
+ |
DISALLOW_COPY_AND_ASSIGN(BookmarkModel); |
}; |