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_BOOKMARKS_BOOKMARK_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_API_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_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/extension_function.h" | 15 #include "chrome/browser/extensions/extension_function.h" |
16 #include "chrome/browser/ui/select_file_dialog.h" | |
17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "ui/base/dialogs/select_file_dialog.h" |
19 | 19 |
20 class FilePath; | 20 class FilePath; |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class ListValue; | 23 class ListValue; |
24 } | 24 } |
25 | 25 |
26 // Observes BookmarkModel and then routes the notifications as events to | 26 // Observes BookmarkModel and then routes the notifications as events to |
27 // the extension system. | 27 // the extension system. |
28 class BookmarkExtensionEventRouter : public BookmarkModelObserver { | 28 class BookmarkExtensionEventRouter : public BookmarkModelObserver { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 QuotaLimitHeuristics* heuristics) const OVERRIDE; | 232 QuotaLimitHeuristics* heuristics) const OVERRIDE; |
233 | 233 |
234 protected: | 234 protected: |
235 virtual ~UpdateBookmarkFunction() {} | 235 virtual ~UpdateBookmarkFunction() {} |
236 | 236 |
237 // ExtensionFunction: | 237 // ExtensionFunction: |
238 virtual bool RunImpl() OVERRIDE; | 238 virtual bool RunImpl() OVERRIDE; |
239 }; | 239 }; |
240 | 240 |
241 class BookmarksIOFunction : public BookmarksFunction, | 241 class BookmarksIOFunction : public BookmarksFunction, |
242 public SelectFileDialog::Listener { | 242 public ui::SelectFileDialog::Listener { |
243 public: | 243 public: |
244 BookmarksIOFunction(); | 244 BookmarksIOFunction(); |
245 | 245 |
246 virtual void FileSelected(const FilePath& path, int index, void* params) = 0; | 246 virtual void FileSelected(const FilePath& path, int index, void* params) = 0; |
247 | 247 |
248 // SelectFileDialog::Listener: | 248 // ui::SelectFileDialog::Listener: |
249 virtual void MultiFilesSelected(const std::vector<FilePath>& files, | 249 virtual void MultiFilesSelected(const std::vector<FilePath>& files, |
250 void* params) OVERRIDE; | 250 void* params) OVERRIDE; |
251 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 251 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
252 | 252 |
253 void SelectFile(SelectFileDialog::Type type); | 253 void SelectFile(ui::SelectFileDialog::Type type); |
254 | 254 |
255 protected: | 255 protected: |
256 virtual ~BookmarksIOFunction(); | 256 virtual ~BookmarksIOFunction(); |
257 | 257 |
258 private: | 258 private: |
259 void ShowSelectFileDialog( | 259 void ShowSelectFileDialog( |
260 SelectFileDialog::Type type, | 260 ui::SelectFileDialog::Type type, |
261 const FilePath& default_path); | 261 const FilePath& default_path); |
262 | 262 |
263 protected: | 263 protected: |
264 scoped_refptr<SelectFileDialog> select_file_dialog_; | 264 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
265 }; | 265 }; |
266 | 266 |
267 class ImportBookmarksFunction : public BookmarksIOFunction { | 267 class ImportBookmarksFunction : public BookmarksIOFunction { |
268 public: | 268 public: |
269 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.import"); | 269 DECLARE_EXTENSION_FUNCTION_NAME("bookmarks.import"); |
270 | 270 |
271 // BookmarkManagerIOFunction: | 271 // BookmarkManagerIOFunction: |
272 virtual void FileSelected(const FilePath& path, int index, void* params) | 272 virtual void FileSelected(const FilePath& path, int index, void* params) |
273 OVERRIDE; | 273 OVERRIDE; |
274 | 274 |
(...skipping 13 matching lines...) Expand all Loading... |
288 OVERRIDE; | 288 OVERRIDE; |
289 | 289 |
290 private: | 290 private: |
291 virtual ~ExportBookmarksFunction() {} | 291 virtual ~ExportBookmarksFunction() {} |
292 | 292 |
293 // ExtensionFunction: | 293 // ExtensionFunction: |
294 virtual bool RunImpl() OVERRIDE; | 294 virtual bool RunImpl() OVERRIDE; |
295 }; | 295 }; |
296 | 296 |
297 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_API_H_ | 297 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EXTENSION_API_H_ |
OLD | NEW |