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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 static const char* service_name() { | 107 static const char* service_name() { |
108 return "BookmarksAPI"; | 108 return "BookmarksAPI"; |
109 } | 109 } |
110 static const bool kServiceIsNULLWhileTesting = true; | 110 static const bool kServiceIsNULLWhileTesting = true; |
111 | 111 |
112 // Created lazily upon OnListenerAdded. | 112 // Created lazily upon OnListenerAdded. |
113 scoped_ptr<BookmarkEventRouter> bookmark_event_router_; | 113 scoped_ptr<BookmarkEventRouter> bookmark_event_router_; |
114 }; | 114 }; |
115 | 115 |
116 class BookmarksFunction : public ChromeAsyncExtensionFunction, | 116 class BookmarksFunction : public ChromeAsyncExtensionFunction, |
117 public BaseBookmarkModelObserver { | 117 public bookmarks::BaseBookmarkModelObserver { |
118 public: | 118 public: |
119 // AsyncExtensionFunction: | 119 // AsyncExtensionFunction: |
120 bool RunAsync() override; | 120 bool RunAsync() override; |
121 | 121 |
122 protected: | 122 protected: |
123 ~BookmarksFunction() override {} | 123 ~BookmarksFunction() override {} |
124 | 124 |
125 // RunAsync semantic equivalent called when the bookmarks are ready. | 125 // RunAsync semantic equivalent called when the bookmarks are ready. |
126 virtual bool RunOnReady() = 0; | 126 virtual bool RunOnReady() = 0; |
127 | 127 |
(...skipping 24 matching lines...) Expand all Loading... |
152 // error_ to the appropriate error string. | 152 // error_ to the appropriate error string. |
153 bool EditBookmarksEnabled(); | 153 bool EditBookmarksEnabled(); |
154 | 154 |
155 // Helper that checks if |node| can be modified. Returns false if |node| | 155 // Helper that checks if |node| can be modified. Returns false if |node| |
156 // is NULL, or a managed node, or the root node. In these cases the node | 156 // is NULL, or a managed node, or the root node. In these cases the node |
157 // can't be edited, can't have new child nodes appended, and its direct | 157 // can't be edited, can't have new child nodes appended, and its direct |
158 // children can't be moved or reordered. | 158 // children can't be moved or reordered. |
159 bool CanBeModified(const BookmarkNode* node); | 159 bool CanBeModified(const BookmarkNode* node); |
160 | 160 |
161 private: | 161 private: |
162 // BaseBookmarkModelObserver: | 162 // bookmarks::BaseBookmarkModelObserver: |
163 void BookmarkModelChanged() override; | 163 void BookmarkModelChanged() override; |
164 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; | 164 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; |
165 | 165 |
166 void RunAndSendResponse(); | 166 void RunAndSendResponse(); |
167 }; | 167 }; |
168 | 168 |
169 class BookmarksGetFunction : public BookmarksFunction { | 169 class BookmarksGetFunction : public BookmarksFunction { |
170 public: | 170 public: |
171 DECLARE_EXTENSION_FUNCTION("bookmarks.get", BOOKMARKS_GET) | 171 DECLARE_EXTENSION_FUNCTION("bookmarks.get", BOOKMARKS_GET) |
172 | 172 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 private: | 352 private: |
353 ~BookmarksExportFunction() override {} | 353 ~BookmarksExportFunction() override {} |
354 | 354 |
355 // BookmarksFunction: | 355 // BookmarksFunction: |
356 bool RunOnReady() override; | 356 bool RunOnReady() override; |
357 }; | 357 }; |
358 | 358 |
359 } // namespace extensions | 359 } // namespace extensions |
360 | 360 |
361 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ | 361 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
OLD | NEW |