Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: components/bookmarks/browser/bookmark_model_observer.h

Issue 1205603002: Remove dependency of HistoryServiceFactory on ChromeBookmarkClientFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split_history_client
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_OBSERVER_H_ 5 #ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_OBSERVER_H_
6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_OBSERVER_H_ 6 #define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_OBSERVER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 class GURL; 10 class GURL;
11 11
12 namespace bookmarks { 12 namespace bookmarks {
13 13
14 class BookmarkModel; 14 class BookmarkModel;
15 class BookmarkNode; 15 class BookmarkNode;
16 16
17 // Observer for the BookmarkModel. 17 // Observer for the BookmarkModel.
18 class BookmarkModelObserver { 18 class BookmarkModelObserver {
19 public: 19 public:
20 // Invoked when the model has finished loading. |ids_reassigned| mirrors 20 // Invoked when the model has finished loading. |ids_reassigned| mirrors
21 // that of BookmarkLoadDetails::ids_reassigned. See it for details. 21 // that of BookmarkLoadDetails::ids_reassigned. See it for details.
22 virtual void BookmarkModelLoaded(BookmarkModel* model, 22 virtual void BookmarkModelLoaded(BookmarkModel* model,
23 bool ids_reassigned) = 0; 23 bool ids_reassigned) {}
24 24
25 // Invoked from the destructor of the BookmarkModel. 25 // Invoked from the destructor of the BookmarkModel.
26 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) {} 26 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) {}
27 27
28 // Invoked when a node has moved. 28 // Invoked when a node has moved.
29 virtual void BookmarkNodeMoved(BookmarkModel* model, 29 virtual void BookmarkNodeMoved(BookmarkModel* model,
30 const BookmarkNode* old_parent, 30 const BookmarkNode* old_parent,
31 int old_index, 31 int old_index,
32 const BookmarkNode* new_parent, 32 const BookmarkNode* new_parent,
33 int new_index) = 0; 33 int new_index) {}
34 34
35 // Invoked when a node has been added. 35 // Invoked when a node has been added.
36 virtual void BookmarkNodeAdded(BookmarkModel* model, 36 virtual void BookmarkNodeAdded(BookmarkModel* model,
37 const BookmarkNode* parent, 37 const BookmarkNode* parent,
38 int index) = 0; 38 int index) {}
39 39
40 // Invoked prior to removing a node from the model. When a node is removed 40 // Invoked prior to removing a node from the model. When a node is removed
41 // it's descendants are implicitly removed from the model as 41 // it's descendants are implicitly removed from the model as
42 // well. Notification is only sent for the node itself, not any 42 // well. Notification is only sent for the node itself, not any
43 // descendants. For example, if folder 'A' has the children 'A1' and 'A2', 43 // descendants. For example, if folder 'A' has the children 'A1' and 'A2',
44 // model->Remove('A') generates a single notification for 'A'; no notification 44 // model->Remove('A') generates a single notification for 'A'; no notification
45 // is sent for 'A1' or 'A2'. 45 // is sent for 'A1' or 'A2'.
46 // 46 //
47 // |parent| the parent of the node that will be removed. 47 // |parent| the parent of the node that will be removed.
48 // |old_index| the index of the node about to be removed in |parent|. 48 // |old_index| the index of the node about to be removed in |parent|.
(...skipping 12 matching lines...) Expand all
61 // |old_index| the index of the removed node in |parent| before it was 61 // |old_index| the index of the removed node in |parent| before it was
62 // removed. 62 // removed.
63 // |node| the node that was removed. 63 // |node| the node that was removed.
64 // |no_longer_bookmarked| contains the urls of any nodes that are no longer 64 // |no_longer_bookmarked| contains the urls of any nodes that are no longer
65 // bookmarked as a result of the removal. 65 // bookmarked as a result of the removal.
66 virtual void BookmarkNodeRemoved( 66 virtual void BookmarkNodeRemoved(
67 BookmarkModel* model, 67 BookmarkModel* model,
68 const BookmarkNode* parent, 68 const BookmarkNode* parent,
69 int old_index, 69 int old_index,
70 const BookmarkNode* node, 70 const BookmarkNode* node,
71 const std::set<GURL>& no_longer_bookmarked) = 0; 71 const std::set<GURL>& no_longer_bookmarked) {}
72 72
73 // Invoked before the title or url of a node is changed. 73 // Invoked before the title or url of a node is changed.
74 virtual void OnWillChangeBookmarkNode(BookmarkModel* model, 74 virtual void OnWillChangeBookmarkNode(BookmarkModel* model,
75 const BookmarkNode* node) {} 75 const BookmarkNode* node) {}
76 76
77 // Invoked when the title or url of a node changes. 77 // Invoked when the title or url of a node changes.
78 virtual void BookmarkNodeChanged(BookmarkModel* model, 78 virtual void BookmarkNodeChanged(BookmarkModel* model,
79 const BookmarkNode* node) = 0; 79 const BookmarkNode* node) {}
80 80
81 // Invoked before the metainfo of a node is changed. 81 // Invoked before the metainfo of a node is changed.
82 virtual void OnWillChangeBookmarkMetaInfo(BookmarkModel* model, 82 virtual void OnWillChangeBookmarkMetaInfo(BookmarkModel* model,
83 const BookmarkNode* node) {} 83 const BookmarkNode* node) {}
84 84
85 // Invoked when the metainfo on a node changes. 85 // Invoked when the metainfo on a node changes.
86 virtual void BookmarkMetaInfoChanged(BookmarkModel* model, 86 virtual void BookmarkMetaInfoChanged(BookmarkModel* model,
87 const BookmarkNode* node) {} 87 const BookmarkNode* node) {}
88 88
89 // Invoked when a favicon has been loaded or changed. 89 // Invoked when a favicon has been loaded or changed.
90 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, 90 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model,
91 const BookmarkNode* node) = 0; 91 const BookmarkNode* node) {}
92 92
93 // Invoked before the direct children of |node| have been reordered in some 93 // Invoked before the direct children of |node| have been reordered in some
94 // way, such as sorted. 94 // way, such as sorted.
95 virtual void OnWillReorderBookmarkNode(BookmarkModel* model, 95 virtual void OnWillReorderBookmarkNode(BookmarkModel* model,
96 const BookmarkNode* node) {} 96 const BookmarkNode* node) {}
97 97
98 // Invoked when the children (just direct children, not descendants) of 98 // Invoked when the children (just direct children, not descendants) of
99 // |node| have been reordered in some way, such as sorted. 99 // |node| have been reordered in some way, such as sorted.
100 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, 100 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
101 const BookmarkNode* node) = 0; 101 const BookmarkNode* node) {}
102 102
103 // Invoked before an extensive set of model changes is about to begin. 103 // Invoked before an extensive set of model changes is about to begin.
104 // This tells UI intensive observers to wait until the updates finish to 104 // This tells UI intensive observers to wait until the updates finish to
105 // update themselves. 105 // update themselves.
106 // These methods should only be used for imports and sync. 106 // These methods should only be used for imports and sync.
107 // Observers should still respond to BookmarkNodeRemoved immediately, 107 // Observers should still respond to BookmarkNodeRemoved immediately,
108 // to avoid holding onto stale node pointers. 108 // to avoid holding onto stale node pointers.
109 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) {} 109 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) {}
110 110
111 // Invoked after an extensive set of model changes has ended. 111 // Invoked after an extensive set of model changes has ended.
112 // This tells observers to update themselves if they were waiting for the 112 // This tells observers to update themselves if they were waiting for the
113 // update to finish. 113 // update to finish.
114 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) {} 114 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) {}
115 115
116 // Invoked before all non-permanent bookmark nodes that are editable by 116 // Invoked before all non-permanent bookmark nodes that are editable by
117 // the user are removed. 117 // the user are removed.
118 virtual void OnWillRemoveAllUserBookmarks(BookmarkModel* model) {} 118 virtual void OnWillRemoveAllUserBookmarks(BookmarkModel* model) {}
119 119
120 // Invoked when all non-permanent bookmark nodes that are editable by the 120 // Invoked when all non-permanent bookmark nodes that are editable by the
121 // user have been removed. 121 // user have been removed.
122 // |removed_urls| is populated with the urls which no longer have any 122 // |removed_urls| is populated with the urls which no longer have any
123 // bookmarks associated with them. 123 // bookmarks associated with them.
124 virtual void BookmarkAllUserNodesRemoved( 124 virtual void BookmarkAllUserNodesRemoved(
125 BookmarkModel* model, 125 BookmarkModel* model,
126 const std::set<GURL>& removed_urls) = 0; 126 const std::set<GURL>& removed_urls) {}
sky 2015/06/23 16:43:42 The idea with these functions is the one that may
sdefresne 2015/06/23 17:10:21 OK. I've removed the changes to BookmarkModelObser
127 127
128 // Invoked before a set of model changes that is initiated by a single user 128 // Invoked before a set of model changes that is initiated by a single user
129 // action. For example, this is called a single time when pasting from the 129 // action. For example, this is called a single time when pasting from the
130 // clipboard before each pasted bookmark is added to the bookmark model. 130 // clipboard before each pasted bookmark is added to the bookmark model.
131 virtual void GroupedBookmarkChangesBeginning(BookmarkModel* model) {} 131 virtual void GroupedBookmarkChangesBeginning(BookmarkModel* model) {}
132 132
133 // Invoked after a set of model changes triggered by a single user action has 133 // Invoked after a set of model changes triggered by a single user action has
134 // ended. 134 // ended.
135 virtual void GroupedBookmarkChangesEnded(BookmarkModel* model) {} 135 virtual void GroupedBookmarkChangesEnded(BookmarkModel* model) {}
136 136
137 protected: 137 protected:
138 virtual ~BookmarkModelObserver() {} 138 virtual ~BookmarkModelObserver() {}
139 }; 139 };
140 140
141 } // namespace bookmarks 141 } // namespace bookmarks
142 142
143 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_OBSERVER_H_ 143 #endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MODEL_OBSERVER_H_
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service_factory.cc ('k') | components/history/core/browser/history_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698