| 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_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/prefs/public/pref_change_registrar.h" | 10 #include "base/prefs/public/pref_change_registrar.h" |
| 11 #include "base/prefs/public/pref_observer.h" |
| 11 #include "chrome/browser/ui/tabs/hover_tab_selector.h" | 12 #include "chrome/browser/ui/tabs/hover_tab_selector.h" |
| 12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 13 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 14 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
| 14 #include "content/public/browser/notification_observer.h" | |
| 15 | 15 |
| 16 class BaseTab; | 16 class BaseTab; |
| 17 class Browser; | 17 class Browser; |
| 18 class TabContents; | 18 class TabContents; |
| 19 class TabStrip; | 19 class TabStrip; |
| 20 class TabStripSelectionModel; | 20 class TabStripSelectionModel; |
| 21 struct TabRendererData; | 21 struct TabRendererData; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class WebContents; | 24 class WebContents; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // An implementation of TabStripController that sources data from the | 27 // An implementation of TabStripController that sources data from the |
| 28 // TabContentses in a TabStripModel. | 28 // TabContentses in a TabStripModel. |
| 29 class BrowserTabStripController : public TabStripController, | 29 class BrowserTabStripController : public TabStripController, |
| 30 public TabStripModelObserver, | 30 public TabStripModelObserver, |
| 31 public content::NotificationObserver { | 31 public PrefObserver { |
| 32 public: | 32 public: |
| 33 BrowserTabStripController(Browser* browser, TabStripModel* model); | 33 BrowserTabStripController(Browser* browser, TabStripModel* model); |
| 34 virtual ~BrowserTabStripController(); | 34 virtual ~BrowserTabStripController(); |
| 35 | 35 |
| 36 void InitFromModel(TabStrip* tabstrip); | 36 void InitFromModel(TabStrip* tabstrip); |
| 37 | 37 |
| 38 TabStripModel* model() const { return model_; } | 38 TabStripModel* model() const { return model_; } |
| 39 | 39 |
| 40 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, | 40 bool IsCommandEnabledForTab(TabStripModel::ContextMenuCommand command_id, |
| 41 BaseTab* tab) const; | 41 BaseTab* tab) const; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 TabContents* old_contents, | 90 TabContents* old_contents, |
| 91 TabContents* new_contents, | 91 TabContents* new_contents, |
| 92 int model_index) OVERRIDE; | 92 int model_index) OVERRIDE; |
| 93 virtual void TabPinnedStateChanged(TabContents* contents, | 93 virtual void TabPinnedStateChanged(TabContents* contents, |
| 94 int model_index) OVERRIDE; | 94 int model_index) OVERRIDE; |
| 95 virtual void TabMiniStateChanged(TabContents* contents, | 95 virtual void TabMiniStateChanged(TabContents* contents, |
| 96 int model_index) OVERRIDE; | 96 int model_index) OVERRIDE; |
| 97 virtual void TabBlockedStateChanged(TabContents* contents, | 97 virtual void TabBlockedStateChanged(TabContents* contents, |
| 98 int model_index) OVERRIDE; | 98 int model_index) OVERRIDE; |
| 99 | 99 |
| 100 // content::NotificationObserver implementation: | 100 // PrefObserver implementation: |
| 101 virtual void Observe(int type, | 101 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 102 const content::NotificationSource& source, | 102 const std::string& pref_name) OVERRIDE; |
| 103 const content::NotificationDetails& details) OVERRIDE; | |
| 104 | 103 |
| 105 protected: | 104 protected: |
| 106 // The context in which SetTabRendererDataFromModel is being called. | 105 // The context in which SetTabRendererDataFromModel is being called. |
| 107 enum TabStatus { | 106 enum TabStatus { |
| 108 NEW_TAB, | 107 NEW_TAB, |
| 109 EXISTING_TAB | 108 EXISTING_TAB |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 // Sets the TabRendererData from the TabStripModel. | 111 // Sets the TabRendererData from the TabStripModel. |
| 113 virtual void SetTabRendererDataFromModel(content::WebContents* contents, | 112 virtual void SetTabRendererDataFromModel(content::WebContents* contents, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 151 |
| 153 // Helper for performing tab selection as a result of dragging over a tab. | 152 // Helper for performing tab selection as a result of dragging over a tab. |
| 154 HoverTabSelector hover_tab_selector_; | 153 HoverTabSelector hover_tab_selector_; |
| 155 | 154 |
| 156 PrefChangeRegistrar local_pref_registrar_; | 155 PrefChangeRegistrar local_pref_registrar_; |
| 157 | 156 |
| 158 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 157 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
| 159 }; | 158 }; |
| 160 | 159 |
| 161 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 160 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |