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