1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_TAG_MODEL_OBSERVER_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_TAG_MODEL_OBSERVER_H_
8 class BookmarkTagModel;
11 // Observer for the BookmarkTagModel.
12 class BookmarkTagModelObserver {
14 // Invoked when the model has finished loading.
15 virtual void Loaded(BookmarkTagModel* model) = 0;
17 // Invoked from the destructor of the BookmarkTagModel.
18 virtual void BookmarkTagModelBeingDeleted(BookmarkTagModel* model) {}
20 // Invoked when a node has been added.
21 virtual void BookmarkNodeAdded(BookmarkTagModel* model,
22 const BookmarkNode* bookmark) = 0;
24 // Invoked before a node is removed.
25 // |node| is the node to be removed.
26 virtual void OnWillRemoveBookmarks(BookmarkTagModel* model,
27 const BookmarkNode* bookmark) {}
29 // Invoked when a node has been removed, |node| is the node that was removed.
30 virtual void BookmarkNodeRemoved(BookmarkTagModel* model,
31 const BookmarkNode* bookmark) = 0;
33 // Invoked before the title or url of a node is changed.
34 virtual void OnWillChangeBookmarkNode(BookmarkTagModel* model,
35 const BookmarkNode* bookmark) {}
37 // Invoked when the title or url of a node changes.
38 virtual void BookmarkNodeChanged(BookmarkTagModel* model,
39 const BookmarkNode* bookmark) = 0;
41 // Invoked before changing the tags of a node.
42 virtual void OnWillChangeBookmarkTags(BookmarkTagModel* model,
43 const BookmarkNode* bookmark) {}
45 // Invoked when tags are changed on a bookmark.
46 virtual void BookmarkTagsChanged(BookmarkTagModel* model,
47 const BookmarkNode* bookmark) = 0;
49 // Invoked when a favicon has been loaded or changed.
50 virtual void BookmarkNodeFaviconChanged(BookmarkTagModel* model,
51 const BookmarkNode* node) = 0;
53 // Invoked before an extensive set of model changes is about to begin.
54 // This tells UI intensive observers to wait until the updates finish to
56 // These methods should only be used for imports and sync.
57 // Observers should still respond to BookmarkNodeRemoved immediately,
58 // to avoid holding onto stale node pointers.
59 virtual void ExtensiveBookmarkChangesBeginning(BookmarkTagModel* model) {}
61 // Invoked after an extensive set of model changes has ended.
62 // This tells observers to update themselves if they were waiting for the
64 virtual void ExtensiveBookmarkChangesEnded(BookmarkTagModel* model) {}
66 // Invoked before all non-permanent bookmark nodes are removed.
67 virtual void OnWillRemoveAllBookmarks(BookmarkTagModel* model) {}
69 // Invoked when all non-permanent bookmark nodes have been removed.
70 virtual void BookmarkAllNodesRemoved(BookmarkTagModel* model) = 0;
73 virtual ~BookmarkTagModelObserver() {}
76 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_TAG_MODEL_OBSERVER_H_