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_MANAGER_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_EXTENSION_API_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_EXTENSION_API_H_ |
7 | 7 |
| 8 #include "base/values.h" |
8 #include "chrome/browser/bookmarks/bookmark_extension_api.h" | 9 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
9 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 10 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
10 #include "chrome/browser/extensions/extension_function.h" | 11 #include "chrome/browser/extensions/extension_function.h" |
11 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
12 | 13 |
13 struct BookmarkNodeData; | 14 struct BookmarkNodeData; |
14 class Profile; | 15 class Profile; |
15 class TabContents; | 16 class TabContents; |
16 | 17 |
17 namespace base { | |
18 class ListValue; | |
19 } | |
20 | |
21 // Class that handles the chrome.experimental.bookmarkManager events. | 18 // Class that handles the chrome.experimental.bookmarkManager events. |
22 class BookmarkManagerExtensionEventRouter | 19 class BookmarkManagerExtensionEventRouter |
23 : public BookmarkTabHelper::BookmarkDrag { | 20 : public BookmarkTabHelper::BookmarkDrag { |
24 public: | 21 public: |
25 BookmarkManagerExtensionEventRouter(Profile* profile, TabContents* tab); | 22 BookmarkManagerExtensionEventRouter(Profile* profile, TabContents* tab); |
26 virtual ~BookmarkManagerExtensionEventRouter(); | 23 virtual ~BookmarkManagerExtensionEventRouter(); |
27 | 24 |
28 // BookmarkTabHelper::BookmarkDrag interface | 25 // BookmarkTabHelper::BookmarkDrag interface |
29 virtual void OnDragEnter(const BookmarkNodeData& data) OVERRIDE; | 26 virtual void OnDragEnter(const BookmarkNodeData& data) OVERRIDE; |
30 virtual void OnDragOver(const BookmarkNodeData& data) OVERRIDE; | 27 virtual void OnDragOver(const BookmarkNodeData& data) OVERRIDE; |
31 virtual void OnDragLeave(const BookmarkNodeData& data) OVERRIDE; | 28 virtual void OnDragLeave(const BookmarkNodeData& data) OVERRIDE; |
32 virtual void OnDrop(const BookmarkNodeData& data) OVERRIDE; | 29 virtual void OnDrop(const BookmarkNodeData& data) OVERRIDE; |
33 | 30 |
34 // The bookmark drag and drop data. This gets set after a drop was done on | 31 // The bookmark drag and drop data. This gets set after a drop was done on |
35 // the page. This returns NULL if no data is available. | 32 // the page. This returns NULL if no data is available. |
36 const BookmarkNodeData* GetBookmarkNodeData(); | 33 const BookmarkNodeData* GetBookmarkNodeData(); |
37 | 34 |
38 // Clears the drag and drop data. | 35 // Clears the drag and drop data. |
39 void ClearBookmarkNodeData(); | 36 void ClearBookmarkNodeData(); |
40 | 37 |
41 private: | 38 private: |
42 // Helper to actually dispatch an event to extension listeners. | 39 // Helper to actually dispatch an event to extension listeners. |
43 void DispatchEvent(const char* event_name, const base::ListValue* args); | 40 void DispatchEvent(const char* event_name, |
| 41 scoped_ptr<base::ListValue> args); |
44 | 42 |
45 void DispatchDragEvent(const BookmarkNodeData& data, const char* event_name); | 43 void DispatchDragEvent(const BookmarkNodeData& data, const char* event_name); |
46 | 44 |
47 Profile* profile_; | 45 Profile* profile_; |
48 TabContents* tab_; | 46 TabContents* tab_; |
49 BookmarkNodeData bookmark_drag_data_; | 47 BookmarkNodeData bookmark_drag_data_; |
50 | 48 |
51 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerExtensionEventRouter); | 49 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerExtensionEventRouter); |
52 }; | 50 }; |
53 | 51 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 184 |
187 protected: | 185 protected: |
188 virtual ~CanOpenNewWindowsBookmarkFunction() {} | 186 virtual ~CanOpenNewWindowsBookmarkFunction() {} |
189 | 187 |
190 // ExtensionFunction: | 188 // ExtensionFunction: |
191 virtual bool RunImpl() OVERRIDE; | 189 virtual bool RunImpl() OVERRIDE; |
192 }; | 190 }; |
193 | 191 |
194 | 192 |
195 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_EXTENSION_API_H_ | 193 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_EXTENSION_API_H_ |
OLD | NEW |