| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 10 #include "chrome/browser/extensions/extension_bookmarks_module.h" | 10 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 11 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
| 12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 13 | 13 |
| 14 struct BookmarkNodeData; | 14 struct BookmarkNodeData; |
| 15 class ListValue; | |
| 16 class Profile; | 15 class Profile; |
| 17 class TabContentsWrapper; | 16 class TabContentsWrapper; |
| 18 | 17 |
| 18 namespace base { |
| 19 class ListValue; |
| 20 } |
| 21 |
| 19 // Class that handles the chrome.experimental.bookmarkManager events. | 22 // Class that handles the chrome.experimental.bookmarkManager events. |
| 20 class ExtensionBookmarkManagerEventRouter | 23 class ExtensionBookmarkManagerEventRouter |
| 21 : public BookmarkTabHelper::BookmarkDrag { | 24 : public BookmarkTabHelper::BookmarkDrag { |
| 22 public: | 25 public: |
| 23 ExtensionBookmarkManagerEventRouter(Profile* profile, | 26 ExtensionBookmarkManagerEventRouter(Profile* profile, |
| 24 TabContentsWrapper* tab); | 27 TabContentsWrapper* tab); |
| 25 virtual ~ExtensionBookmarkManagerEventRouter(); | 28 virtual ~ExtensionBookmarkManagerEventRouter(); |
| 26 | 29 |
| 27 // RenderViewHostDelegate::BookmarkDrag interface | 30 // RenderViewHostDelegate::BookmarkDrag interface |
| 28 virtual void OnDragEnter(const BookmarkNodeData& data); | 31 virtual void OnDragEnter(const BookmarkNodeData& data); |
| 29 virtual void OnDragOver(const BookmarkNodeData& data); | 32 virtual void OnDragOver(const BookmarkNodeData& data); |
| 30 virtual void OnDragLeave(const BookmarkNodeData& data); | 33 virtual void OnDragLeave(const BookmarkNodeData& data); |
| 31 virtual void OnDrop(const BookmarkNodeData& data); | 34 virtual void OnDrop(const BookmarkNodeData& data); |
| 32 | 35 |
| 33 // The bookmark drag and drop data. This gets set after a drop was done on | 36 // 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. | 37 // the page. This returns NULL if no data is available. |
| 35 const BookmarkNodeData* GetBookmarkNodeData(); | 38 const BookmarkNodeData* GetBookmarkNodeData(); |
| 36 | 39 |
| 37 // Clears the drag and drop data. | 40 // Clears the drag and drop data. |
| 38 void ClearBookmarkNodeData(); | 41 void ClearBookmarkNodeData(); |
| 39 | 42 |
| 40 private: | 43 private: |
| 41 // Helper to actually dispatch an event to extension listeners. | 44 // Helper to actually dispatch an event to extension listeners. |
| 42 void DispatchEvent(const char* event_name, const ListValue* args); | 45 void DispatchEvent(const char* event_name, const base::ListValue* args); |
| 43 | 46 |
| 44 void DispatchDragEvent(const BookmarkNodeData& data, const char* event_name); | 47 void DispatchDragEvent(const BookmarkNodeData& data, const char* event_name); |
| 45 | 48 |
| 46 Profile* profile_; | 49 Profile* profile_; |
| 47 TabContentsWrapper* tab_; | 50 TabContentsWrapper* tab_; |
| 48 BookmarkNodeData bookmark_drag_data_; | 51 BookmarkNodeData bookmark_drag_data_; |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkManagerEventRouter); | 53 DISALLOW_COPY_AND_ASSIGN(ExtensionBookmarkManagerEventRouter); |
| 51 }; | 54 }; |
| 52 | 55 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 132 |
| 130 class CanEditBookmarkManagerFunction : public BookmarksFunction { | 133 class CanEditBookmarkManagerFunction : public BookmarksFunction { |
| 131 public: | 134 public: |
| 132 virtual bool RunImpl() OVERRIDE; | 135 virtual bool RunImpl() OVERRIDE; |
| 133 | 136 |
| 134 private: | 137 private: |
| 135 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.canEdit"); | 138 DECLARE_EXTENSION_FUNCTION_NAME("experimental.bookmarkManager.canEdit"); |
| 136 }; | 139 }; |
| 137 | 140 |
| 138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ | 141 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BOOKMARK_MANAGER_API_H_ |
| OLD | NEW |