OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_API_BOOKMARKS_BOOKMARKS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 23 matching lines...) Expand all Loading... |
34 namespace api { | 34 namespace api { |
35 namespace bookmarks { | 35 namespace bookmarks { |
36 struct CreateDetails; | 36 struct CreateDetails; |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 // Observes BookmarkModel and then routes the notifications as events to | 40 // Observes BookmarkModel and then routes the notifications as events to |
41 // the extension system. | 41 // the extension system. |
42 class BookmarkEventRouter : public BookmarkModelObserver { | 42 class BookmarkEventRouter : public BookmarkModelObserver { |
43 public: | 43 public: |
44 BookmarkEventRouter(content::BrowserContext* context, BookmarkModel* model); | 44 explicit BookmarkEventRouter(Profile* profile); |
45 virtual ~BookmarkEventRouter(); | 45 virtual ~BookmarkEventRouter(); |
46 | 46 |
47 // BookmarkModelObserver: | 47 // BookmarkModelObserver: |
48 virtual void BookmarkModelLoaded(BookmarkModel* model, | 48 virtual void BookmarkModelLoaded(BookmarkModel* model, |
49 bool ids_reassigned) OVERRIDE; | 49 bool ids_reassigned) OVERRIDE; |
50 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; | 50 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; |
51 virtual void BookmarkNodeMoved(BookmarkModel* model, | 51 virtual void BookmarkNodeMoved(BookmarkModel* model, |
52 const BookmarkNode* old_parent, | 52 const BookmarkNode* old_parent, |
53 int old_index, | 53 int old_index, |
54 const BookmarkNode* new_parent, | 54 const BookmarkNode* new_parent, |
(...skipping 18 matching lines...) Expand all Loading... |
73 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) OVERRIDE; | 73 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel* model) OVERRIDE; |
74 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) OVERRIDE; | 74 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel* model) OVERRIDE; |
75 | 75 |
76 private: | 76 private: |
77 // Helper to actually dispatch an event to extension listeners. | 77 // Helper to actually dispatch an event to extension listeners. |
78 void DispatchEvent(const std::string& event_name, | 78 void DispatchEvent(const std::string& event_name, |
79 scoped_ptr<base::ListValue> event_args); | 79 scoped_ptr<base::ListValue> event_args); |
80 | 80 |
81 content::BrowserContext* browser_context_; | 81 content::BrowserContext* browser_context_; |
82 BookmarkModel* model_; | 82 BookmarkModel* model_; |
| 83 ChromeBookmarkClient* client_; |
83 | 84 |
84 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter); | 85 DISALLOW_COPY_AND_ASSIGN(BookmarkEventRouter); |
85 }; | 86 }; |
86 | 87 |
87 class BookmarksAPI : public BrowserContextKeyedAPI, | 88 class BookmarksAPI : public BrowserContextKeyedAPI, |
88 public EventRouter::Observer { | 89 public EventRouter::Observer { |
89 public: | 90 public: |
90 explicit BookmarksAPI(content::BrowserContext* context); | 91 explicit BookmarksAPI(content::BrowserContext* context); |
91 virtual ~BookmarksAPI(); | 92 virtual ~BookmarksAPI(); |
92 | 93 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 private: | 366 private: |
366 virtual ~BookmarksExportFunction() {} | 367 virtual ~BookmarksExportFunction() {} |
367 | 368 |
368 // BookmarksFunction: | 369 // BookmarksFunction: |
369 virtual bool RunOnReady() OVERRIDE; | 370 virtual bool RunOnReady() OVERRIDE; |
370 }; | 371 }; |
371 | 372 |
372 } // namespace extensions | 373 } // namespace extensions |
373 | 374 |
374 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ | 375 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
OLD | NEW |