Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / android / provider / bookmark_model_observer_task.h
blob2746d24f81b03f15fe2dfd99572f1000ce845232
1 // Copyright (c) 2012 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_ANDROID_PROVIDER_BOOKMARK_MODEL_OBSERVER_TASK_H_
6 #define CHROME_BROWSER_ANDROID_PROVIDER_BOOKMARK_MODEL_OBSERVER_TASK_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "components/bookmarks/browser/bookmark_model_observer.h"
12 // Base class for synchronous tasks that involve the bookmark model.
13 // Ensures the model has been loaded before accessing it.
14 // Must not be created from the UI thread.
15 class BookmarkModelTask {
16 public:
17 explicit BookmarkModelTask(bookmarks::BookmarkModel* model);
18 bookmarks::BookmarkModel* model() const;
20 private:
21 bookmarks::BookmarkModel* model_;
23 DISALLOW_COPY_AND_ASSIGN(BookmarkModelTask);
26 // Base class for bookmark model tasks that observe for model updates.
27 class BookmarkModelObserverTask : public BookmarkModelTask,
28 public bookmarks::BookmarkModelObserver {
29 public:
30 explicit BookmarkModelObserverTask(bookmarks::BookmarkModel* bookmark_model);
31 ~BookmarkModelObserverTask() override;
33 // bookmarks::BookmarkModelObserver:
34 void BookmarkModelLoaded(bookmarks::BookmarkModel* model,
35 bool ids_reassigned) override;
36 void BookmarkNodeMoved(bookmarks::BookmarkModel* model,
37 const bookmarks::BookmarkNode* old_parent,
38 int old_index,
39 const bookmarks::BookmarkNode* new_parent,
40 int new_index) override;
41 void BookmarkNodeAdded(bookmarks::BookmarkModel* model,
42 const bookmarks::BookmarkNode* parent,
43 int index) override;
44 void BookmarkNodeRemoved(bookmarks::BookmarkModel* model,
45 const bookmarks::BookmarkNode* parent,
46 int old_index,
47 const bookmarks::BookmarkNode* node,
48 const std::set<GURL>& removed_urls) override;
49 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel* model,
50 const std::set<GURL>& removed_urls) override;
51 void BookmarkNodeChanged(bookmarks::BookmarkModel* model,
52 const bookmarks::BookmarkNode* node) override;
53 void BookmarkNodeFaviconChanged(bookmarks::BookmarkModel* model,
54 const bookmarks::BookmarkNode* node) override;
55 void BookmarkNodeChildrenReordered(
56 bookmarks::BookmarkModel* model,
57 const bookmarks::BookmarkNode* node) override;
59 private:
60 DISALLOW_COPY_AND_ASSIGN(BookmarkModelObserverTask);
63 #endif // CHROME_BROWSER_ANDROID_PROVIDER_BOOKMARK_MODEL_OBSERVER_TASK_H_