| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSION_BOOKMARK_MANAGER_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 8 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
| 9 #include "chrome/browser/extensions/extension_bookmarks_module.h" | 9 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 12 #include "chrome/browser/shell_dialogs.h" | 12 #include "chrome/browser/shell_dialogs.h" |
| 13 | 13 |
| 14 struct BookmarkDragData; |
| 14 class BookmarkNode; | 15 class BookmarkNode; |
| 15 class ListValue; | 16 class ListValue; |
| 16 class Profile; | 17 class Profile; |
| 17 class TabContents; | 18 class TabContents; |
| 18 | 19 |
| 19 // Class that handles the chrome.experimental.bookmarkManager events. | 20 // Class that handles the chrome.experimental.bookmarkManager events. |
| 20 class ExtensionBookmarkManagerEventRouter | 21 class ExtensionBookmarkManagerEventRouter |
| 21 : public RenderViewHostDelegate::BookmarkDrag { | 22 : public RenderViewHostDelegate::BookmarkDrag { |
| 22 public: | 23 public: |
| 23 ExtensionBookmarkManagerEventRouter(Profile* profile, | 24 ExtensionBookmarkManagerEventRouter(Profile* profile, |
| 24 TabContents* tab_contents); | 25 TabContents* tab_contents); |
| 25 virtual ~ExtensionBookmarkManagerEventRouter(); | 26 virtual ~ExtensionBookmarkManagerEventRouter(); |
| 26 | 27 |
| 27 // RenderViewHostDelegate::BookmarkDrag interface | 28 // RenderViewHostDelegate::BookmarkDrag interface |
| 28 virtual void OnDragEnter(const DragData* data); | 29 virtual void OnDragEnter(const BookmarkDragData& data); |
| 29 virtual void OnDragOver(const DragData* data); | 30 virtual void OnDragOver(const BookmarkDragData& data); |
| 30 virtual void OnDragLeave(const DragData* data); | 31 virtual void OnDragLeave(const BookmarkDragData& data); |
| 31 virtual void OnDrop(const DragData* data); | 32 virtual void OnDrop(const BookmarkDragData& data); |
| 32 | 33 |
| 33 // The bookmark drag and drop data. This gets set after a drop was done on | 34 // The bookmark drag and drop data. This gets set after a drop was done on |
| 34 // the page. This returns NULL if no data is available. | 35 // the page. This returns NULL if no data is available. |
| 35 const BookmarkDragData* GetBookmarkDragData(); | 36 const BookmarkDragData* GetBookmarkDragData(); |
| 36 | 37 |
| 37 // Clears the drag and drop data. | 38 // Clears the drag and drop data. |
| 38 void ClearBookmarkDragData(); | 39 void ClearBookmarkDragData(); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 // Helper to actually dispatch an event to extension listeners. | 42 // Helper to actually dispatch an event to extension listeners. |
| 42 void DispatchEvent(const char* event_name, const ListValue* args); | 43 void DispatchEvent(const char* event_name, const ListValue* args); |
| 43 | 44 |
| 44 void DispatchDragEvent(const DragData* data, const char* event_name); | 45 void DispatchDragEvent(const BookmarkDragData& data, const char* event_name); |
| 45 | 46 |
| 46 Profile* profile_; | 47 Profile* profile_; |
| 47 TabContents* tab_contents_; | 48 TabContents* tab_contents_; |
| 48 BookmarkDragData bookmark_drag_data_; | 49 BookmarkDragData bookmark_drag_data_; |
| 49 | 50 |
| 50 DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkManagerEventRouter); | 51 DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkManagerEventRouter); |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 class ClipboardBookmarkManagerFunction : public BookmarksFunction { | 54 class ClipboardBookmarkManagerFunction : public BookmarksFunction { |
| 54 protected: | 55 protected: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 158 |
| 158 class DropBookmarkManagerFunction : public BookmarksFunction { | 159 class DropBookmarkManagerFunction : public BookmarksFunction { |
| 159 public: | 160 public: |
| 160 virtual bool RunImpl(); | 161 virtual bool RunImpl(); |
| 161 | 162 |
| 162 private: | 163 private: |
| 163 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.drop"); | 164 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.drop"); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ | 167 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ |
| OLD | NEW |