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

Side by Side Diff: chrome/browser/extensions/extension_bookmarks_module.h

Issue 102009: more extensions bookmarks changes:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_bookmarks_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_H__ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_H__ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_H_
7 7
8 #include <string>
9 #include <vector>
10
11 #include "base/singleton.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h"
8 #include "chrome/browser/extensions/extension_function.h" 13 #include "chrome/browser/extensions/extension_function.h"
9 14
10 class GetBookmarksFunction : public SyncExtensionFunction { 15 // Observes BookmarkModel and then routes the notifications as events to
16 // the extension system.
17 class ExtensionBookmarkEventRouter : public BookmarkModelObserver {
18 public:
19 static ExtensionBookmarkEventRouter* GetSingleton();
20 virtual ~ExtensionBookmarkEventRouter();
21
22 // Call this for each model to observe. Safe to call multiple times per
23 // model.
24 void Observe(BookmarkModel* model);
25
26 // BookmarkModelObserver
27 virtual void Loaded(BookmarkModel* model);
28 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) { }
29 virtual void BookmarkNodeMoved(BookmarkModel* model,
30 BookmarkNode* old_parent,
31 int old_index,
32 BookmarkNode* new_parent,
33 int new_index);
34 virtual void BookmarkNodeAdded(BookmarkModel* model,
35 BookmarkNode* parent,
36 int index);
37 virtual void BookmarkNodeRemoved(BookmarkModel* model,
38 BookmarkNode* parent,
39 int index);
40 virtual void BookmarkNodeRemoved(BookmarkModel* model,
41 BookmarkNode* parent,
42 int old_index,
43 BookmarkNode* node) {
44 BookmarkNodeRemoved(model, parent, old_index);
45 }
46 virtual void BookmarkNodeChanged(BookmarkModel* model,
47 BookmarkNode* node);
48 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
49 BookmarkNode* node);
50 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model,
51 BookmarkNode* node);
52
53 private:
54 ExtensionBookmarkEventRouter();
55 friend struct DefaultSingletonTraits<ExtensionBookmarkEventRouter>;
56
57 // Helper to actually dispatch an event to extension listeners.
58 void DispatchEvent(Profile* profile,
59 const char* event_name,
60 const std::string json_args);
61
62 // These are stored so that Observe can be called multiple times safely.
63 // This way the caller doesn't have to know whether it's already observing
64 // a particular model or not. The pointers are not owned by this object.
65 std::set<BookmarkModel*> models_;
66
67 DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkEventRouter);
68 };
69
70 class BookmarksFunction : public SyncExtensionFunction {
71 virtual void Run();
72 };
73
74 class GetBookmarksFunction : public BookmarksFunction {
11 virtual bool RunImpl(); 75 virtual bool RunImpl();
12 }; 76 };
13 77
14 class SearchBookmarksFunction : public SyncExtensionFunction { 78 class GetBookmarkChildrenFunction : public BookmarksFunction {
15 virtual bool RunImpl(); 79 virtual bool RunImpl();
16 }; 80 };
17 81
18 class RemoveBookmarkFunction : public SyncExtensionFunction { 82 class GetBookmarkTreeFunction : public BookmarksFunction {
19 virtual bool RunImpl(); 83 virtual bool RunImpl();
20 }; 84 };
21 85
22 class CreateBookmarkFunction : public SyncExtensionFunction { 86 class SearchBookmarksFunction : public BookmarksFunction {
23 virtual bool RunImpl(); 87 virtual bool RunImpl();
24 }; 88 };
25 89
26 class MoveBookmarkFunction : public SyncExtensionFunction { 90 class RemoveBookmarkFunction : public BookmarksFunction {
27 virtual bool RunImpl(); 91 virtual bool RunImpl();
28 }; 92 };
29 93
30 class SetBookmarkTitleFunction : public SyncExtensionFunction { 94 class CreateBookmarkFunction : public BookmarksFunction {
31 virtual bool RunImpl(); 95 virtual bool RunImpl();
32 }; 96 };
33 97
34 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_H__ 98 class MoveBookmarkFunction : public BookmarksFunction {
99 virtual bool RunImpl();
100 };
35 101
102 class SetBookmarkTitleFunction : public BookmarksFunction {
103 virtual bool RunImpl();
104 };
105
106 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARKS_MODULE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_bookmarks_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698