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/search/search_model_observer.h" | 12 #include "chrome/browser/ui/search/search_model_observer.h" |
12 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" | 13 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" |
13 #include "chrome/browser/ui/tabs/hover_tab_selector.h" | 14 #include "chrome/browser/ui/tabs/hover_tab_selector.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 16 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
16 #include "content/public/browser/notification_observer.h" | |
17 | 17 |
18 class BaseTab; | 18 class BaseTab; |
19 class Browser; | 19 class Browser; |
20 class TabContents; | 20 class TabContents; |
21 class TabStrip; | 21 class TabStrip; |
22 class TabStripSelectionModel; | 22 class TabStripSelectionModel; |
23 struct TabRendererData; | 23 struct TabRendererData; |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 class WebContents; | 26 class WebContents; |
27 } | 27 } |
28 | 28 |
29 // An implementation of TabStripController that sources data from the | 29 // An implementation of TabStripController that sources data from the |
30 // TabContentses in a TabStripModel. | 30 // TabContentses in a TabStripModel. |
31 class BrowserTabStripController | 31 class BrowserTabStripController |
32 : public TabStripController, | 32 : public TabStripController, |
33 public TabStripModelObserver, | 33 public TabStripModelObserver, |
34 public content::NotificationObserver, | 34 public PrefObserver, |
35 public chrome::search::SearchModelObserver, | 35 public chrome::search::SearchModelObserver, |
36 public chrome::search::ToolbarSearchAnimatorObserver { | 36 public chrome::search::ToolbarSearchAnimatorObserver { |
37 public: | 37 public: |
38 BrowserTabStripController(Browser* browser, TabStripModel* model); | 38 BrowserTabStripController(Browser* browser, TabStripModel* model); |
39 virtual ~BrowserTabStripController(); | 39 virtual ~BrowserTabStripController(); |
40 | 40 |
41 void InitFromModel(TabStrip* tabstrip); | 41 void InitFromModel(TabStrip* tabstrip); |
42 | 42 |
43 TabStripModel* model() const { return model_; } | 43 TabStripModel* model() const { return model_; } |
44 | 44 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // chrome::search::SearchModelObserver implementation: | 107 // chrome::search::SearchModelObserver implementation: |
108 virtual void ModeChanged(const chrome::search::Mode& old_mode, | 108 virtual void ModeChanged(const chrome::search::Mode& old_mode, |
109 const chrome::search::Mode& new_mode) OVERRIDE; | 109 const chrome::search::Mode& new_mode) OVERRIDE; |
110 | 110 |
111 // chrome::search::ToolbarSearchAnimatorObserver implementation: | 111 // chrome::search::ToolbarSearchAnimatorObserver implementation: |
112 virtual void OnToolbarBackgroundAnimatorProgressed() OVERRIDE; | 112 virtual void OnToolbarBackgroundAnimatorProgressed() OVERRIDE; |
113 virtual void OnToolbarBackgroundAnimatorCanceled( | 113 virtual void OnToolbarBackgroundAnimatorCanceled( |
114 content::WebContents* web_contents) OVERRIDE; | 114 content::WebContents* web_contents) OVERRIDE; |
115 virtual void OnToolbarSeparatorChanged() OVERRIDE {} | 115 virtual void OnToolbarSeparatorChanged() OVERRIDE {} |
116 | 116 |
117 // content::NotificationObserver implementation: | 117 // PrefObserver implementation: |
118 virtual void Observe(int type, | 118 virtual void OnPreferenceChanged(PrefServiceBase* service, |
119 const content::NotificationSource& source, | 119 const std::string& pref_name) OVERRIDE; |
120 const content::NotificationDetails& details) OVERRIDE; | |
121 | 120 |
122 protected: | 121 protected: |
123 // The context in which SetTabRendererDataFromModel is being called. | 122 // The context in which SetTabRendererDataFromModel is being called. |
124 enum TabStatus { | 123 enum TabStatus { |
125 NEW_TAB, | 124 NEW_TAB, |
126 EXISTING_TAB | 125 EXISTING_TAB |
127 }; | 126 }; |
128 | 127 |
129 // Sets the TabRendererData from the TabStripModel. | 128 // Sets the TabRendererData from the TabStripModel. |
130 virtual void SetTabRendererDataFromModel(content::WebContents* contents, | 129 virtual void SetTabRendererDataFromModel(content::WebContents* contents, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 168 |
170 // Helper for performing tab selection as a result of dragging over a tab. | 169 // Helper for performing tab selection as a result of dragging over a tab. |
171 HoverTabSelector hover_tab_selector_; | 170 HoverTabSelector hover_tab_selector_; |
172 | 171 |
173 PrefChangeRegistrar local_pref_registrar_; | 172 PrefChangeRegistrar local_pref_registrar_; |
174 | 173 |
175 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); | 174 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); |
176 }; | 175 }; |
177 | 176 |
178 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ | 177 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ |
OLD | NEW |