| 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_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_
PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_
PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_
PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAGER_
PRIVATE_API_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" | 10 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
| 11 #include "chrome/browser/extensions/chrome_extension_function.h" | 11 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 12 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 13 #include "chrome/browser/undo/bookmark_undo_service.h" | 13 #include "chrome/browser/undo/bookmark_undo_service.h" |
| 14 #include "chrome/browser/undo/bookmark_undo_service_factory.h" | 14 #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
| 15 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 15 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
| 16 #include "components/bookmarks/browser/bookmark_node_data.h" | 16 #include "components/bookmarks/browser/bookmark_node_data.h" |
| 17 #include "extensions/browser/browser_context_keyed_api_factory.h" | 17 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 18 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
| 19 | 19 |
| 20 class Profile; |
| 21 |
| 22 namespace bookmarks { |
| 20 struct BookmarkNodeData; | 23 struct BookmarkNodeData; |
| 21 class Profile; | 24 } |
| 22 | 25 |
| 23 namespace content { | 26 namespace content { |
| 24 class BrowserContext; | 27 class BrowserContext; |
| 25 class WebContents; | 28 class WebContents; |
| 26 } | 29 } |
| 27 | 30 |
| 28 namespace extensions { | 31 namespace extensions { |
| 29 | 32 |
| 30 class BookmarkManagerPrivateEventRouter : public BaseBookmarkModelObserver { | 33 class BookmarkManagerPrivateEventRouter : public BaseBookmarkModelObserver { |
| 31 public: | 34 public: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Class that handles the drag and drop related chrome.bookmarkManagerPrivate | 88 // Class that handles the drag and drop related chrome.bookmarkManagerPrivate |
| 86 // events. This class has one instance per bookmark manager tab. | 89 // events. This class has one instance per bookmark manager tab. |
| 87 class BookmarkManagerPrivateDragEventRouter | 90 class BookmarkManagerPrivateDragEventRouter |
| 88 : public BookmarkTabHelper::BookmarkDrag { | 91 : public BookmarkTabHelper::BookmarkDrag { |
| 89 public: | 92 public: |
| 90 BookmarkManagerPrivateDragEventRouter(Profile* profile, | 93 BookmarkManagerPrivateDragEventRouter(Profile* profile, |
| 91 content::WebContents* web_contents); | 94 content::WebContents* web_contents); |
| 92 virtual ~BookmarkManagerPrivateDragEventRouter(); | 95 virtual ~BookmarkManagerPrivateDragEventRouter(); |
| 93 | 96 |
| 94 // BookmarkTabHelper::BookmarkDrag interface | 97 // BookmarkTabHelper::BookmarkDrag interface |
| 95 virtual void OnDragEnter(const BookmarkNodeData& data) OVERRIDE; | 98 virtual void OnDragEnter(const bookmarks::BookmarkNodeData& data) OVERRIDE; |
| 96 virtual void OnDragOver(const BookmarkNodeData& data) OVERRIDE; | 99 virtual void OnDragOver(const bookmarks::BookmarkNodeData& data) OVERRIDE; |
| 97 virtual void OnDragLeave(const BookmarkNodeData& data) OVERRIDE; | 100 virtual void OnDragLeave(const bookmarks::BookmarkNodeData& data) OVERRIDE; |
| 98 virtual void OnDrop(const BookmarkNodeData& data) OVERRIDE; | 101 virtual void OnDrop(const bookmarks::BookmarkNodeData& data) OVERRIDE; |
| 99 | 102 |
| 100 // The bookmark drag and drop data. This gets set after a drop was done on | 103 // The bookmark drag and drop data. This gets set after a drop was done on |
| 101 // the page. This returns NULL if no data is available. | 104 // the page. This returns NULL if no data is available. |
| 102 const BookmarkNodeData* GetBookmarkNodeData(); | 105 const bookmarks::BookmarkNodeData* GetBookmarkNodeData(); |
| 103 | 106 |
| 104 // Clears the drag and drop data. | 107 // Clears the drag and drop data. |
| 105 void ClearBookmarkNodeData(); | 108 void ClearBookmarkNodeData(); |
| 106 | 109 |
| 107 private: | 110 private: |
| 108 // Helper to actually dispatch an event to extension listeners. | 111 // Helper to actually dispatch an event to extension listeners. |
| 109 void DispatchEvent(const std::string& event_name, | 112 void DispatchEvent(const std::string& event_name, |
| 110 scoped_ptr<base::ListValue> args); | 113 scoped_ptr<base::ListValue> args); |
| 111 | 114 |
| 112 Profile* profile_; | 115 Profile* profile_; |
| 113 content::WebContents* web_contents_; | 116 content::WebContents* web_contents_; |
| 114 BookmarkNodeData bookmark_drag_data_; | 117 bookmarks::BookmarkNodeData bookmark_drag_data_; |
| 115 | 118 |
| 116 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerPrivateDragEventRouter); | 119 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerPrivateDragEventRouter); |
| 117 }; | 120 }; |
| 118 | 121 |
| 119 class ClipboardBookmarkManagerFunction : public extensions::BookmarksFunction { | 122 class ClipboardBookmarkManagerFunction : public extensions::BookmarksFunction { |
| 120 protected: | 123 protected: |
| 121 virtual ~ClipboardBookmarkManagerFunction() {} | 124 virtual ~ClipboardBookmarkManagerFunction() {} |
| 122 | 125 |
| 123 bool CopyOrCut(bool cut, const std::vector<std::string>& id_list); | 126 bool CopyOrCut(bool cut, const std::vector<std::string>& id_list); |
| 124 }; | 127 }; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 protected: | 394 protected: |
| 392 virtual ~BookmarkManagerPrivateGetRedoInfoFunction() {} | 395 virtual ~BookmarkManagerPrivateGetRedoInfoFunction() {} |
| 393 | 396 |
| 394 // ExtensionFunction: | 397 // ExtensionFunction: |
| 395 virtual bool RunOnReady() OVERRIDE; | 398 virtual bool RunOnReady() OVERRIDE; |
| 396 }; | 399 }; |
| 397 | 400 |
| 398 } // namespace extensions | 401 } // namespace extensions |
| 399 | 402 |
| 400 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAG
ER_PRIVATE_API_H_ | 403 #endif // CHROME_BROWSER_EXTENSIONS_API_BOOKMARK_MANAGER_PRIVATE_BOOKMARK_MANAG
ER_PRIVATE_API_H_ |
| OLD | NEW |