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