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_BOOKMARK_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_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> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
15 #include "chrome/browser/extensions/event_router.h" | 15 #include "chrome/browser/extensions/event_router.h" |
16 #include "chrome/browser/extensions/extension_function.h" | 16 #include "chrome/browser/extensions/extension_function.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 private: | 110 private: |
111 // content::NotificationObserver: | 111 // content::NotificationObserver: |
112 virtual void Observe(int type, | 112 virtual void Observe(int type, |
113 const content::NotificationSource& source, | 113 const content::NotificationSource& source, |
114 const content::NotificationDetails& details) OVERRIDE; | 114 const content::NotificationDetails& details) OVERRIDE; |
115 | 115 |
116 content::NotificationRegistrar registrar_; | 116 content::NotificationRegistrar registrar_; |
117 }; | 117 }; |
118 | 118 |
119 class GetBookmarksFunction : public BookmarksFunction { | 119 class BookmarksGetTreeFunction : public BookmarksFunction { |
120 public: | 120 public: |
121 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.get") | 121 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.get") |
122 | 122 |
123 protected: | 123 protected: |
124 virtual ~GetBookmarksFunction() {} | 124 virtual ~BookmarksGetTreeFunction() {} |
125 | 125 |
126 // ExtensionFunction: | 126 // ExtensionFunction: |
127 virtual bool RunImpl() OVERRIDE; | 127 virtual bool RunImpl() OVERRIDE; |
128 }; | 128 }; |
129 | 129 |
130 class GetBookmarkChildrenFunction : public BookmarksFunction { | 130 class BookmarksGetChildrenFunction : public BookmarksFunction { |
131 public: | 131 public: |
132 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getChildren") | 132 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getChildren") |
133 | 133 |
134 protected: | 134 protected: |
135 virtual ~GetBookmarkChildrenFunction() {} | 135 virtual ~BookmarksGetChildrenFunction() {} |
136 | 136 |
137 // ExtensionFunction: | 137 // ExtensionFunction: |
138 virtual bool RunImpl() OVERRIDE; | 138 virtual bool RunImpl() OVERRIDE; |
139 }; | 139 }; |
140 | 140 |
141 class GetBookmarkRecentFunction : public BookmarksFunction { | 141 class BookmarksGetFunction : public BookmarksFunction { |
142 public: | 142 public: |
143 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getRecent") | 143 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getRecent") |
144 | 144 |
145 protected: | 145 protected: |
146 virtual ~GetBookmarkRecentFunction() {} | 146 virtual ~BookmarksGetFunction() {} |
147 | 147 |
148 // ExtensionFunction: | 148 // ExtensionFunction: |
149 virtual bool RunImpl() OVERRIDE; | 149 virtual bool RunImpl() OVERRIDE; |
150 }; | 150 }; |
151 | 151 |
152 class GetBookmarkTreeFunction : public BookmarksFunction { | 152 class BookmarksGetSubTreeFunction : public BookmarksFunction { |
153 public: | 153 public: |
154 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getTree") | 154 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getTree") |
155 | 155 |
156 protected: | 156 protected: |
157 virtual ~GetBookmarkTreeFunction() {} | 157 virtual ~BookmarksGetSubTreeFunction() {} |
158 | 158 |
159 // ExtensionFunction: | 159 // ExtensionFunction: |
160 virtual bool RunImpl() OVERRIDE; | 160 virtual bool RunImpl() OVERRIDE; |
161 }; | 161 }; |
162 | 162 |
163 class GetBookmarkSubTreeFunction : public BookmarksFunction { | 163 class BookmarksGetRecentFunction : public BookmarksFunction { |
164 public: | 164 public: |
165 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getSubTree") | 165 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.getSubTree") |
166 | 166 |
167 protected: | 167 protected: |
168 virtual ~GetBookmarkSubTreeFunction() {} | 168 virtual ~BookmarksGetRecentFunction() {} |
169 | 169 |
170 // ExtensionFunction: | 170 // ExtensionFunction: |
171 virtual bool RunImpl() OVERRIDE; | 171 virtual bool RunImpl() OVERRIDE; |
172 }; | 172 }; |
173 | 173 |
174 class SearchBookmarksFunction : public BookmarksFunction { | 174 class BookmarksSearchFunction : public BookmarksFunction { |
175 public: | 175 public: |
176 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.search") | 176 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.search") |
177 | 177 |
178 protected: | 178 protected: |
179 virtual ~SearchBookmarksFunction() {} | 179 virtual ~BookmarksSearchFunction() {} |
180 | 180 |
181 // ExtensionFunction: | 181 // ExtensionFunction: |
182 virtual bool RunImpl() OVERRIDE; | 182 virtual bool RunImpl() OVERRIDE; |
183 }; | 183 }; |
184 | 184 |
185 class RemoveBookmarkFunction : public BookmarksFunction { | 185 class BookmarksRemoveFunction : public BookmarksFunction { |
186 public: | 186 public: |
187 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.remove") | 187 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.remove") |
188 | 188 |
189 // Returns true on successful parse and sets invalid_id to true if conversion | 189 // Returns true on successful parse and sets invalid_id to true if conversion |
190 // from id string to int64 failed. | 190 // from id string to int64 failed. |
191 static bool ExtractIds(const base::ListValue* args, std::list<int64>* ids, | 191 static bool ExtractIds(const base::ListValue* args, std::list<int64>* ids, |
192 bool* invalid_id); | 192 bool* invalid_id); |
193 // ExtensionFunction: | 193 // ExtensionFunction: |
194 virtual void GetQuotaLimitHeuristics( | 194 virtual void GetQuotaLimitHeuristics( |
195 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 195 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
196 | 196 |
197 protected: | 197 protected: |
198 virtual ~RemoveBookmarkFunction() {} | 198 virtual ~BookmarksRemoveFunction() {} |
199 | 199 |
200 // ExtensionFunction: | 200 // ExtensionFunction: |
201 virtual bool RunImpl() OVERRIDE; | 201 virtual bool RunImpl() OVERRIDE; |
202 }; | 202 }; |
203 | 203 |
204 class RemoveTreeBookmarkFunction : public RemoveBookmarkFunction { | 204 class BookmarksRemoveTreeFunction : public BookmarksRemoveFunction { |
205 public: | 205 public: |
206 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.removeTree") | 206 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.removeTree") |
207 | 207 |
208 protected: | 208 protected: |
209 virtual ~RemoveTreeBookmarkFunction() {} | 209 virtual ~BookmarksRemoveTreeFunction() {} |
210 }; | 210 }; |
211 | 211 |
212 class CreateBookmarkFunction : public BookmarksFunction { | 212 class BookmarksCreateFunction : public BookmarksFunction { |
213 public: | 213 public: |
214 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.create") | 214 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.create") |
215 | 215 |
216 // ExtensionFunction: | 216 // ExtensionFunction: |
217 virtual void GetQuotaLimitHeuristics( | 217 virtual void GetQuotaLimitHeuristics( |
218 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 218 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
219 | 219 |
220 protected: | 220 protected: |
221 virtual ~CreateBookmarkFunction() {} | 221 virtual ~BookmarksCreateFunction() {} |
222 | 222 |
223 // ExtensionFunction: | 223 // ExtensionFunction: |
224 virtual bool RunImpl() OVERRIDE; | 224 virtual bool RunImpl() OVERRIDE; |
225 }; | 225 }; |
226 | 226 |
227 class MoveBookmarkFunction : public BookmarksFunction { | 227 class BookmarksMoveFunction : public BookmarksFunction { |
228 public: | 228 public: |
229 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.move") | 229 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.move") |
230 | 230 |
231 static bool ExtractIds(const base::ListValue* args, std::list<int64>* ids, | 231 static bool ExtractIds(const base::ListValue* args, std::list<int64>* ids, |
232 bool* invalid_id); | 232 bool* invalid_id); |
233 | 233 |
234 // ExtensionFunction: | 234 // ExtensionFunction: |
235 virtual void GetQuotaLimitHeuristics( | 235 virtual void GetQuotaLimitHeuristics( |
236 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 236 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
237 | 237 |
238 protected: | 238 protected: |
239 virtual ~MoveBookmarkFunction() {} | 239 virtual ~BookmarksMoveFunction() {} |
240 | 240 |
241 // ExtensionFunction: | 241 // ExtensionFunction: |
242 virtual bool RunImpl() OVERRIDE; | 242 virtual bool RunImpl() OVERRIDE; |
243 }; | 243 }; |
244 | 244 |
245 class UpdateBookmarkFunction : public BookmarksFunction { | 245 class BookmarksUpdateFunction : public BookmarksFunction { |
246 public: | 246 public: |
247 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.update") | 247 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.update") |
248 | 248 |
249 static bool ExtractIds(const base::ListValue* args, std::list<int64>* ids, | 249 static bool ExtractIds(const base::ListValue* args, std::list<int64>* ids, |
250 bool* invalid_id); | 250 bool* invalid_id); |
251 | 251 |
252 // ExtensionFunction: | 252 // ExtensionFunction: |
253 virtual void GetQuotaLimitHeuristics( | 253 virtual void GetQuotaLimitHeuristics( |
254 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 254 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
255 | 255 |
256 protected: | 256 protected: |
257 virtual ~UpdateBookmarkFunction() {} | 257 virtual ~BookmarksUpdateFunction() {} |
258 | 258 |
259 // ExtensionFunction: | 259 // ExtensionFunction: |
260 virtual bool RunImpl() OVERRIDE; | 260 virtual bool RunImpl() OVERRIDE; |
261 }; | 261 }; |
262 | 262 |
263 class BookmarksIOFunction : public BookmarksFunction, | 263 class BookmarksIOFunction : public BookmarksFunction, |
264 public ui::SelectFileDialog::Listener { | 264 public ui::SelectFileDialog::Listener { |
265 public: | 265 public: |
266 BookmarksIOFunction(); | 266 BookmarksIOFunction(); |
267 | 267 |
(...skipping 11 matching lines...) Expand all Loading... |
279 | 279 |
280 private: | 280 private: |
281 void ShowSelectFileDialog( | 281 void ShowSelectFileDialog( |
282 ui::SelectFileDialog::Type type, | 282 ui::SelectFileDialog::Type type, |
283 const FilePath& default_path); | 283 const FilePath& default_path); |
284 | 284 |
285 protected: | 285 protected: |
286 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 286 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
287 }; | 287 }; |
288 | 288 |
289 class ImportBookmarksFunction : public BookmarksIOFunction { | 289 class BookmarksImportFunction : public BookmarksIOFunction { |
290 public: | 290 public: |
291 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.import"); | 291 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.import"); |
292 | 292 |
293 // BookmarkManagerIOFunction: | 293 // BookmarkManagerIOFunction: |
294 virtual void FileSelected(const FilePath& path, int index, void* params) | 294 virtual void FileSelected(const FilePath& path, int index, void* params) |
295 OVERRIDE; | 295 OVERRIDE; |
296 | 296 |
297 private: | 297 private: |
298 virtual ~ImportBookmarksFunction() {} | 298 virtual ~BookmarksImportFunction() {} |
299 | 299 |
300 // ExtensionFunction: | 300 // ExtensionFunction: |
301 virtual bool RunImpl() OVERRIDE; | 301 virtual bool RunImpl() OVERRIDE; |
302 }; | 302 }; |
303 | 303 |
304 class ExportBookmarksFunction : public BookmarksIOFunction { | 304 class BookmarksExportFunction : public BookmarksIOFunction { |
305 public: | 305 public: |
306 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.export"); | 306 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.export"); |
307 | 307 |
308 // BookmarkManagerIOFunction: | 308 // BookmarkManagerIOFunction: |
309 virtual void FileSelected(const FilePath& path, int index, void* params) | 309 virtual void FileSelected(const FilePath& path, int index, void* params) |
310 OVERRIDE; | 310 OVERRIDE; |
311 | 311 |
312 private: | 312 private: |
313 virtual ~ExportBookmarksFunction() {} | 313 virtual ~BookmarksExportFunction() {} |
314 | 314 |
315 // ExtensionFunction: | 315 // ExtensionFunction: |
316 virtual bool RunImpl() OVERRIDE; | 316 virtual bool RunImpl() OVERRIDE; |
317 }; | 317 }; |
318 | 318 |
319 } // namespace extensions | 319 } // namespace extensions |
320 | 320 |
321 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARK_API_H_ | 321 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
OLD | NEW |