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_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ |
7 | 7 |
8 #include "components/bookmarks/browser/base_bookmark_model_observer.h" | 8 #include "components/bookmarks/browser/base_bookmark_model_observer.h" |
9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
10 #include "content/public/browser/web_contents_user_data.h" | 10 #include "content/public/browser/web_contents_user_data.h" |
11 | 11 |
12 class BookmarkTabHelperDelegate; | 12 class BookmarkTabHelperDelegate; |
13 | 13 |
14 namespace bookmarks { | 14 namespace bookmarks { |
15 struct BookmarkNodeData; | 15 struct BookmarkNodeData; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 // Per-tab class to manage bookmarks. | 22 // Per-tab class to manage bookmarks. |
23 class BookmarkTabHelper | 23 class BookmarkTabHelper |
24 : public BaseBookmarkModelObserver, | 24 : public bookmarks::BaseBookmarkModelObserver, |
25 public content::WebContentsObserver, | 25 public content::WebContentsObserver, |
26 public content::WebContentsUserData<BookmarkTabHelper> { | 26 public content::WebContentsUserData<BookmarkTabHelper> { |
27 public: | 27 public: |
28 // Interface for forwarding bookmark drag and drop to extenstions. | 28 // Interface for forwarding bookmark drag and drop to extenstions. |
29 class BookmarkDrag { | 29 class BookmarkDrag { |
30 public: | 30 public: |
31 virtual void OnDragEnter(const bookmarks::BookmarkNodeData& data) = 0; | 31 virtual void OnDragEnter(const bookmarks::BookmarkNodeData& data) = 0; |
32 virtual void OnDragOver(const bookmarks::BookmarkNodeData& data) = 0; | 32 virtual void OnDragOver(const bookmarks::BookmarkNodeData& data) = 0; |
33 virtual void OnDragLeave(const bookmarks::BookmarkNodeData& data) = 0; | 33 virtual void OnDragLeave(const bookmarks::BookmarkNodeData& data) = 0; |
34 virtual void OnDrop(const bookmarks::BookmarkNodeData& data) = 0; | 34 virtual void OnDrop(const bookmarks::BookmarkNodeData& data) = 0; |
(...skipping 23 matching lines...) Expand all Loading... |
58 | 58 |
59 private: | 59 private: |
60 friend class content::WebContentsUserData<BookmarkTabHelper>; | 60 friend class content::WebContentsUserData<BookmarkTabHelper>; |
61 | 61 |
62 explicit BookmarkTabHelper(content::WebContents* web_contents); | 62 explicit BookmarkTabHelper(content::WebContents* web_contents); |
63 | 63 |
64 // Updates the starred state from the BookmarkModel. If the state has changed, | 64 // Updates the starred state from the BookmarkModel. If the state has changed, |
65 // the delegate is notified. | 65 // the delegate is notified. |
66 void UpdateStarredStateForCurrentURL(); | 66 void UpdateStarredStateForCurrentURL(); |
67 | 67 |
68 // Overridden from BaseBookmarkModelObserver: | 68 // Overridden from bookmarks::BaseBookmarkModelObserver: |
69 void BookmarkModelChanged() override; | 69 void BookmarkModelChanged() override; |
70 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; | 70 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override; |
71 void BookmarkNodeAdded(BookmarkModel* model, | 71 void BookmarkNodeAdded(BookmarkModel* model, |
72 const BookmarkNode* parent, | 72 const BookmarkNode* parent, |
73 int index) override; | 73 int index) override; |
74 void BookmarkNodeRemoved(BookmarkModel* model, | 74 void BookmarkNodeRemoved(BookmarkModel* model, |
75 const BookmarkNode* parent, | 75 const BookmarkNode* parent, |
76 int old_index, | 76 int old_index, |
77 const BookmarkNode* node, | 77 const BookmarkNode* node, |
78 const std::set<GURL>& removed_urls) override; | 78 const std::set<GURL>& removed_urls) override; |
(...skipping 20 matching lines...) Expand all Loading... |
99 BookmarkTabHelperDelegate* delegate_; | 99 BookmarkTabHelperDelegate* delegate_; |
100 | 100 |
101 // The BookmarkDrag is used to forward bookmark drag and drop events to | 101 // The BookmarkDrag is used to forward bookmark drag and drop events to |
102 // extensions. | 102 // extensions. |
103 BookmarkDrag* bookmark_drag_; | 103 BookmarkDrag* bookmark_drag_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(BookmarkTabHelper); | 105 DISALLOW_COPY_AND_ASSIGN(BookmarkTabHelper); |
106 }; | 106 }; |
107 | 107 |
108 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ | 108 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ |
OLD | NEW |