- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / bookmarks / bookmark_tag_model_observer.h
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.
4
5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_TAG_MODEL_OBSERVER_H_
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_TAG_MODEL_OBSERVER_H_
7
8 class BookmarkTagModel;
9 class BookmarkNode;
10
11 // Observer for the BookmarkTagModel.
12 class BookmarkTagModelObserver {
13  public:
14   // Invoked when the model has finished loading.
15   virtual void Loaded(BookmarkTagModel* model) = 0;
16
17   // Invoked from the destructor of the BookmarkTagModel.
18   virtual void BookmarkTagModelBeingDeleted(BookmarkTagModel* model) {}
19
20   // Invoked when a node has been added.
21   virtual void BookmarkNodeAdded(BookmarkTagModel* model,
22                                  const BookmarkNode* bookmark) = 0;
23
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) {}
28
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;
32
33   // Invoked before the title or url of a node is changed.
34   virtual void OnWillChangeBookmarkNode(BookmarkTagModel* model,
35                                         const BookmarkNode* bookmark) {}
36
37   // Invoked when the title or url of a node changes.
38   virtual void BookmarkNodeChanged(BookmarkTagModel* model,
39                                    const BookmarkNode* bookmark) = 0;
40
41   // Invoked before changing the tags of a node.
42   virtual void OnWillChangeBookmarkTags(BookmarkTagModel* model,
43                                         const BookmarkNode* bookmark) {}
44
45   // Invoked when tags are changed on a bookmark.
46   virtual void BookmarkTagsChanged(BookmarkTagModel* model,
47                                    const BookmarkNode* bookmark) = 0;
48
49   // Invoked when a favicon has been loaded or changed.
50   virtual void BookmarkNodeFaviconChanged(BookmarkTagModel* model,
51                                           const BookmarkNode* node) = 0;
52
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
55   // update themselves.
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) {}
60
61   // Invoked after an extensive set of model changes has ended.
62   // This tells observers to update themselves if they were waiting for the
63   // update to finish.
64   virtual void ExtensiveBookmarkChangesEnded(BookmarkTagModel* model) {}
65
66   // Invoked before all non-permanent bookmark nodes are removed.
67   virtual void OnWillRemoveAllBookmarks(BookmarkTagModel* model) {}
68
69   // Invoked when all non-permanent bookmark nodes have been removed.
70   virtual void BookmarkAllNodesRemoved(BookmarkTagModel* model) = 0;
71
72  protected:
73   virtual ~BookmarkTagModelObserver() {}
74 };
75
76 #endif  // CHROME_BROWSER_BOOKMARKS_BOOKMARK_TAG_MODEL_OBSERVER_H_