| 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_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "content/browser/tab_contents/tab_contents_observer.h" | 9 #include "content/browser/tab_contents/tab_contents_observer.h" |
| 10 #include "content/common/notification_observer.h" | 10 #include "content/common/notification_observer.h" |
| 11 #include "content/common/notification_registrar.h" | 11 #include "content/common/notification_registrar.h" |
| 12 | 12 |
| 13 class BookmarksTabHelperDelegate; | 13 class BookmarkTabHelperDelegate; |
| 14 class TabContentsWrapper; | 14 class TabContentsWrapper; |
| 15 | 15 |
| 16 // Per-tab class to manage bookmarks. | 16 // Per-tab class to manage bookmarks. |
| 17 class BookmarksTabHelper : public NotificationObserver, | 17 class BookmarkTabHelper : public NotificationObserver, |
| 18 public TabContentsObserver { | 18 public TabContentsObserver { |
| 19 public: | 19 public: |
| 20 explicit BookmarksTabHelper(TabContentsWrapper* tab_contents); | 20 explicit BookmarkTabHelper(TabContentsWrapper* tab_contents); |
| 21 virtual ~BookmarksTabHelper(); | 21 virtual ~BookmarkTabHelper(); |
| 22 | 22 |
| 23 bool is_starred() const { return is_starred_; } | 23 bool is_starred() const { return is_starred_; } |
| 24 | 24 |
| 25 BookmarksTabHelperDelegate* delegate() const { return delegate_; } | 25 BookmarkTabHelperDelegate* delegate() const { return delegate_; } |
| 26 void set_delegate(BookmarksTabHelperDelegate* d) { delegate_ = d; } | 26 void set_delegate(BookmarkTabHelperDelegate* d) { delegate_ = d; } |
| 27 | 27 |
| 28 // TabContentsObserver overrides: | 28 // TabContentsObserver overrides: |
| 29 virtual void DidNavigateMainFramePostCommit( | 29 virtual void DidNavigateMainFramePostCommit( |
| 30 const NavigationController::LoadCommittedDetails& details, | 30 const NavigationController::LoadCommittedDetails& details, |
| 31 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | 31 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
| 32 | 32 |
| 33 // NotificationObserver overrides: | 33 // NotificationObserver overrides: |
| 34 virtual void Observe(NotificationType type, | 34 virtual void Observe(NotificationType type, |
| 35 const NotificationSource& source, | 35 const NotificationSource& source, |
| 36 const NotificationDetails& details) OVERRIDE; | 36 const NotificationDetails& details) OVERRIDE; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // Updates the starred state from the bookmark bar model. If the state has | 39 // Updates the starred state from the bookmark bar model. If the state has |
| 40 // changed, the delegate is notified. | 40 // changed, the delegate is notified. |
| 41 void UpdateStarredStateForCurrentURL(); | 41 void UpdateStarredStateForCurrentURL(); |
| 42 | 42 |
| 43 // Whether the current URL is starred. | 43 // Whether the current URL is starred. |
| 44 bool is_starred_; | 44 bool is_starred_; |
| 45 | 45 |
| 46 // Registers and unregisters us for notifications. | 46 // Registers and unregisters us for notifications. |
| 47 NotificationRegistrar registrar_; | 47 NotificationRegistrar registrar_; |
| 48 | 48 |
| 49 // Owning TabContentsWrapper. | 49 // Owning TabContentsWrapper. |
| 50 TabContentsWrapper* tab_contents_wrapper_; | 50 TabContentsWrapper* tab_contents_wrapper_; |
| 51 | 51 |
| 52 // Delegate for notifying our owner (usually Browser) about stuff. Not owned | 52 // Delegate for notifying our owner (usually Browser) about stuff. Not owned |
| 53 // by us. | 53 // by us. |
| 54 BookmarksTabHelperDelegate* delegate_; | 54 BookmarkTabHelperDelegate* delegate_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(BookmarksTabHelper); | 56 DISALLOW_COPY_AND_ASSIGN(BookmarkTabHelper); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARKS_TAB_HELPER_H_ | 59 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_TAB_HELPER_H_ |
| OLD | NEW |