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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // bookmarks::BaseBookmarkModelObserver: | 170 // bookmarks::BaseBookmarkModelObserver: |
171 void BookmarkModelChanged() override; | 171 void BookmarkModelChanged() override; |
172 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, | 172 void BookmarkModelLoaded(bookmarks::BookmarkModel* model, |
173 bool ids_reassigned) override; | 173 bool ids_reassigned) override; |
174 | 174 |
175 void RunAndSendResponse(); | 175 void RunAndSendResponse(); |
176 }; | 176 }; |
177 | 177 |
178 class BookmarksGetFunction : public BookmarksFunction { | 178 class BookmarksGetFunction : public BookmarksFunction { |
179 public: | 179 public: |
| 180 BookmarksGetFunction(); |
180 DECLARE_EXTENSION_FUNCTION("bookmarks.get", BOOKMARKS_GET) | 181 DECLARE_EXTENSION_FUNCTION("bookmarks.get", BOOKMARKS_GET) |
181 | 182 |
182 protected: | 183 protected: |
183 ~BookmarksGetFunction() override {} | 184 ~BookmarksGetFunction() override {} |
184 | 185 |
185 // BookmarksFunction: | 186 // BookmarksFunction: |
186 bool RunOnReady() override; | 187 bool RunOnReady() override; |
187 }; | 188 }; |
188 | 189 |
189 class BookmarksGetChildrenFunction : public BookmarksFunction { | 190 class BookmarksGetChildrenFunction : public BookmarksFunction { |
190 public: | 191 public: |
| 192 BookmarksGetChildrenFunction(); |
191 DECLARE_EXTENSION_FUNCTION("bookmarks.getChildren", BOOKMARKS_GETCHILDREN) | 193 DECLARE_EXTENSION_FUNCTION("bookmarks.getChildren", BOOKMARKS_GETCHILDREN) |
192 | 194 |
193 protected: | 195 protected: |
194 ~BookmarksGetChildrenFunction() override {} | 196 ~BookmarksGetChildrenFunction() override {} |
195 | 197 |
196 // BookmarksFunction: | 198 // BookmarksFunction: |
197 bool RunOnReady() override; | 199 bool RunOnReady() override; |
198 }; | 200 }; |
199 | 201 |
200 class BookmarksGetRecentFunction : public BookmarksFunction { | 202 class BookmarksGetRecentFunction : public BookmarksFunction { |
201 public: | 203 public: |
| 204 BookmarksGetRecentFunction(); |
202 DECLARE_EXTENSION_FUNCTION("bookmarks.getRecent", BOOKMARKS_GETRECENT) | 205 DECLARE_EXTENSION_FUNCTION("bookmarks.getRecent", BOOKMARKS_GETRECENT) |
203 | 206 |
204 protected: | 207 protected: |
205 ~BookmarksGetRecentFunction() override {} | 208 ~BookmarksGetRecentFunction() override {} |
206 | 209 |
207 // BookmarksFunction: | 210 // BookmarksFunction: |
208 bool RunOnReady() override; | 211 bool RunOnReady() override; |
209 }; | 212 }; |
210 | 213 |
211 class BookmarksGetTreeFunction : public BookmarksFunction { | 214 class BookmarksGetTreeFunction : public BookmarksFunction { |
212 public: | 215 public: |
| 216 BookmarksGetTreeFunction(); |
213 DECLARE_EXTENSION_FUNCTION("bookmarks.getTree", BOOKMARKS_GETTREE) | 217 DECLARE_EXTENSION_FUNCTION("bookmarks.getTree", BOOKMARKS_GETTREE) |
214 | 218 |
215 protected: | 219 protected: |
216 ~BookmarksGetTreeFunction() override {} | 220 ~BookmarksGetTreeFunction() override {} |
217 | 221 |
218 // BookmarksFunction: | 222 // BookmarksFunction: |
219 bool RunOnReady() override; | 223 bool RunOnReady() override; |
220 }; | 224 }; |
221 | 225 |
222 class BookmarksGetSubTreeFunction : public BookmarksFunction { | 226 class BookmarksGetSubTreeFunction : public BookmarksFunction { |
223 public: | 227 public: |
| 228 BookmarksGetSubTreeFunction(); |
224 DECLARE_EXTENSION_FUNCTION("bookmarks.getSubTree", BOOKMARKS_GETSUBTREE) | 229 DECLARE_EXTENSION_FUNCTION("bookmarks.getSubTree", BOOKMARKS_GETSUBTREE) |
225 | 230 |
226 protected: | 231 protected: |
227 ~BookmarksGetSubTreeFunction() override {} | 232 ~BookmarksGetSubTreeFunction() override {} |
228 | 233 |
229 // BookmarksFunction: | 234 // BookmarksFunction: |
230 bool RunOnReady() override; | 235 bool RunOnReady() override; |
231 }; | 236 }; |
232 | 237 |
233 class BookmarksSearchFunction : public BookmarksFunction { | 238 class BookmarksSearchFunction : public BookmarksFunction { |
234 public: | 239 public: |
| 240 BookmarksSearchFunction(); |
235 DECLARE_EXTENSION_FUNCTION("bookmarks.search", BOOKMARKS_SEARCH) | 241 DECLARE_EXTENSION_FUNCTION("bookmarks.search", BOOKMARKS_SEARCH) |
236 | 242 |
237 protected: | 243 protected: |
238 ~BookmarksSearchFunction() override {} | 244 ~BookmarksSearchFunction() override {} |
239 | 245 |
240 // BookmarksFunction: | 246 // BookmarksFunction: |
241 bool RunOnReady() override; | 247 bool RunOnReady() override; |
242 }; | 248 }; |
243 | 249 |
244 class BookmarksRemoveFunction : public BookmarksFunction { | 250 class BookmarksRemoveFunction : public BookmarksFunction { |
245 public: | 251 public: |
| 252 BookmarksRemoveFunction(); |
246 DECLARE_EXTENSION_FUNCTION("bookmarks.remove", BOOKMARKS_REMOVE) | 253 DECLARE_EXTENSION_FUNCTION("bookmarks.remove", BOOKMARKS_REMOVE) |
247 | 254 |
248 // Returns true on successful parse and sets invalid_id to true if conversion | 255 // Returns true on successful parse and sets invalid_id to true if conversion |
249 // from id string to int64 failed. | 256 // from id string to int64 failed. |
250 static bool ExtractIds(const base::ListValue* args, | 257 static bool ExtractIds(const base::ListValue* args, |
251 std::list<int64>* ids, | 258 std::list<int64>* ids, |
252 bool* invalid_id); | 259 bool* invalid_id); |
253 | 260 |
254 protected: | 261 protected: |
255 ~BookmarksRemoveFunction() override {} | 262 ~BookmarksRemoveFunction() override {} |
256 | 263 |
257 // BookmarksFunction: | 264 // BookmarksFunction: |
258 bool RunOnReady() override; | 265 bool RunOnReady() override; |
259 }; | 266 }; |
260 | 267 |
261 class BookmarksRemoveTreeFunction : public BookmarksRemoveFunction { | 268 class BookmarksRemoveTreeFunction : public BookmarksRemoveFunction { |
262 public: | 269 public: |
| 270 BookmarksRemoveTreeFunction(); |
263 DECLARE_EXTENSION_FUNCTION("bookmarks.removeTree", BOOKMARKS_REMOVETREE) | 271 DECLARE_EXTENSION_FUNCTION("bookmarks.removeTree", BOOKMARKS_REMOVETREE) |
264 | 272 |
265 protected: | 273 protected: |
266 ~BookmarksRemoveTreeFunction() override {} | 274 ~BookmarksRemoveTreeFunction() override {} |
267 }; | 275 }; |
268 | 276 |
269 class BookmarksCreateFunction : public BookmarksFunction { | 277 class BookmarksCreateFunction : public BookmarksFunction { |
270 public: | 278 public: |
| 279 BookmarksCreateFunction(); |
271 DECLARE_EXTENSION_FUNCTION("bookmarks.create", BOOKMARKS_CREATE) | 280 DECLARE_EXTENSION_FUNCTION("bookmarks.create", BOOKMARKS_CREATE) |
272 | 281 |
273 protected: | 282 protected: |
274 ~BookmarksCreateFunction() override {} | 283 ~BookmarksCreateFunction() override {} |
275 | 284 |
276 // BookmarksFunction: | 285 // BookmarksFunction: |
277 bool RunOnReady() override; | 286 bool RunOnReady() override; |
278 }; | 287 }; |
279 | 288 |
280 class BookmarksMoveFunction : public BookmarksFunction { | 289 class BookmarksMoveFunction : public BookmarksFunction { |
281 public: | 290 public: |
| 291 BookmarksMoveFunction(); |
282 DECLARE_EXTENSION_FUNCTION("bookmarks.move", BOOKMARKS_MOVE) | 292 DECLARE_EXTENSION_FUNCTION("bookmarks.move", BOOKMARKS_MOVE) |
283 | 293 |
284 static bool ExtractIds(const base::ListValue* args, | 294 static bool ExtractIds(const base::ListValue* args, |
285 std::list<int64>* ids, | 295 std::list<int64>* ids, |
286 bool* invalid_id); | 296 bool* invalid_id); |
287 | 297 |
288 protected: | 298 protected: |
289 ~BookmarksMoveFunction() override {} | 299 ~BookmarksMoveFunction() override {} |
290 | 300 |
291 // BookmarksFunction: | 301 // BookmarksFunction: |
292 bool RunOnReady() override; | 302 bool RunOnReady() override; |
293 }; | 303 }; |
294 | 304 |
295 class BookmarksUpdateFunction : public BookmarksFunction { | 305 class BookmarksUpdateFunction : public BookmarksFunction { |
296 public: | 306 public: |
| 307 BookmarksUpdateFunction(); |
297 DECLARE_EXTENSION_FUNCTION("bookmarks.update", BOOKMARKS_UPDATE) | 308 DECLARE_EXTENSION_FUNCTION("bookmarks.update", BOOKMARKS_UPDATE) |
298 | 309 |
299 static bool ExtractIds(const base::ListValue* args, | 310 static bool ExtractIds(const base::ListValue* args, |
300 std::list<int64>* ids, | 311 std::list<int64>* ids, |
301 bool* invalid_id); | 312 bool* invalid_id); |
302 | 313 |
303 protected: | 314 protected: |
304 ~BookmarksUpdateFunction() override {} | 315 ~BookmarksUpdateFunction() override {} |
305 | 316 |
306 // BookmarksFunction: | 317 // BookmarksFunction: |
(...skipping 23 matching lines...) Expand all Loading... |
330 void ShowSelectFileDialog( | 341 void ShowSelectFileDialog( |
331 ui::SelectFileDialog::Type type, | 342 ui::SelectFileDialog::Type type, |
332 const base::FilePath& default_path); | 343 const base::FilePath& default_path); |
333 | 344 |
334 protected: | 345 protected: |
335 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 346 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
336 }; | 347 }; |
337 | 348 |
338 class BookmarksImportFunction : public BookmarksIOFunction { | 349 class BookmarksImportFunction : public BookmarksIOFunction { |
339 public: | 350 public: |
| 351 BookmarksImportFunction(); |
340 DECLARE_EXTENSION_FUNCTION("bookmarks.import", BOOKMARKS_IMPORT) | 352 DECLARE_EXTENSION_FUNCTION("bookmarks.import", BOOKMARKS_IMPORT) |
341 | 353 |
342 // BookmarkManagerIOFunction: | 354 // BookmarkManagerIOFunction: |
343 void FileSelected(const base::FilePath& path, | 355 void FileSelected(const base::FilePath& path, |
344 int index, | 356 int index, |
345 void* params) override; | 357 void* params) override; |
346 | 358 |
347 private: | 359 private: |
348 ~BookmarksImportFunction() override {} | 360 ~BookmarksImportFunction() override {} |
349 | 361 |
350 // BookmarksFunction: | 362 // BookmarksFunction: |
351 bool RunOnReady() override; | 363 bool RunOnReady() override; |
352 }; | 364 }; |
353 | 365 |
354 class BookmarksExportFunction : public BookmarksIOFunction { | 366 class BookmarksExportFunction : public BookmarksIOFunction { |
355 public: | 367 public: |
| 368 BookmarksExportFunction(); |
356 DECLARE_EXTENSION_FUNCTION("bookmarks.export", BOOKMARKS_EXPORT) | 369 DECLARE_EXTENSION_FUNCTION("bookmarks.export", BOOKMARKS_EXPORT) |
357 | 370 |
358 // BookmarkManagerIOFunction: | 371 // BookmarkManagerIOFunction: |
359 void FileSelected(const base::FilePath& path, | 372 void FileSelected(const base::FilePath& path, |
360 int index, | 373 int index, |
361 void* params) override; | 374 void* params) override; |
362 | 375 |
363 private: | 376 private: |
364 ~BookmarksExportFunction() override {} | 377 ~BookmarksExportFunction() override {} |
365 | 378 |
366 // BookmarksFunction: | 379 // BookmarksFunction: |
367 bool RunOnReady() override; | 380 bool RunOnReady() override; |
368 }; | 381 }; |
369 | 382 |
370 } // namespace extensions | 383 } // namespace extensions |
371 | 384 |
372 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ | 385 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARKS_BOOKMARKS_API_H_ |
OLD | NEW |