Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.h

Issue 10540100: TabContentsWrapper -> TabContents, part 48. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/prefs/pref_change_registrar.h" 11 #include "chrome/browser/prefs/pref_change_registrar.h"
12 #include "chrome/browser/ui/tabs/hover_tab_selector.h" 12 #include "chrome/browser/ui/tabs/hover_tab_selector.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" 14 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
15 #include "content/public/browser/notification_observer.h" 15 #include "content/public/browser/notification_observer.h"
16 #include "content/public/browser/notification_registrar.h" 16 #include "content/public/browser/notification_registrar.h"
17 17
18 class BaseTab; 18 class BaseTab;
19 class Browser; 19 class Browser;
20 class TabContents; 20 class TabContents;
21 typedef TabContents TabContentsWrapper;
22 class TabStrip; 21 class TabStrip;
23 class TabStripSelectionModel; 22 class TabStripSelectionModel;
24 struct TabRendererData; 23 struct TabRendererData;
25 24
26 namespace content { 25 namespace content {
27 class WebContents; 26 class WebContents;
28 } 27 }
29 28
30 // An implementation of TabStripController that sources data from the 29 // An implementation of TabStripController that sources data from the
31 // TabContentsWrappers in a TabStripModel. 30 // TabContentses in a TabStripModel.
32 class BrowserTabStripController : public TabStripController, 31 class BrowserTabStripController : public TabStripController,
33 public TabStripModelObserver, 32 public TabStripModelObserver,
34 public content::NotificationObserver { 33 public content::NotificationObserver {
35 public: 34 public:
36 BrowserTabStripController(Browser* browser, TabStripModel* model); 35 BrowserTabStripController(Browser* browser, TabStripModel* model);
37 virtual ~BrowserTabStripController(); 36 virtual ~BrowserTabStripController();
38 37
39 void InitFromModel(TabStrip* tabstrip); 38 void InitFromModel(TabStrip* tabstrip);
40 39
41 TabStripModel* model() const { return model_; } 40 TabStripModel* model() const { return model_; }
(...skipping 27 matching lines...) Expand all
69 virtual void PerformDrop(bool drop_before, 68 virtual void PerformDrop(bool drop_before,
70 int index, 69 int index,
71 const GURL& url) OVERRIDE; 70 const GURL& url) OVERRIDE;
72 virtual bool IsCompatibleWith(TabStrip* other) const OVERRIDE; 71 virtual bool IsCompatibleWith(TabStrip* other) const OVERRIDE;
73 virtual void CreateNewTab() OVERRIDE; 72 virtual void CreateNewTab() OVERRIDE;
74 virtual void ClickActiveTab(int index) OVERRIDE; 73 virtual void ClickActiveTab(int index) OVERRIDE;
75 virtual bool IsIncognito() OVERRIDE; 74 virtual bool IsIncognito() OVERRIDE;
76 virtual void LayoutTypeMaybeChanged() OVERRIDE; 75 virtual void LayoutTypeMaybeChanged() OVERRIDE;
77 76
78 // TabStripModelObserver implementation: 77 // TabStripModelObserver implementation:
79 virtual void TabInsertedAt(TabContentsWrapper* contents, 78 virtual void TabInsertedAt(TabContents* contents,
80 int model_index, 79 int model_index,
81 bool is_active) OVERRIDE; 80 bool is_active) OVERRIDE;
82 virtual void TabDetachedAt(TabContentsWrapper* contents, 81 virtual void TabDetachedAt(TabContents* contents,
83 int model_index) OVERRIDE; 82 int model_index) OVERRIDE;
84 virtual void TabSelectionChanged( 83 virtual void TabSelectionChanged(
85 TabStripModel* tab_strip_model, 84 TabStripModel* tab_strip_model,
86 const TabStripSelectionModel& old_model) OVERRIDE; 85 const TabStripSelectionModel& old_model) OVERRIDE;
87 virtual void TabMoved(TabContentsWrapper* contents, 86 virtual void TabMoved(TabContents* contents,
88 int from_model_index, 87 int from_model_index,
89 int to_model_index) OVERRIDE; 88 int to_model_index) OVERRIDE;
90 virtual void TabChangedAt(TabContentsWrapper* contents, 89 virtual void TabChangedAt(TabContents* contents,
91 int model_index, 90 int model_index,
92 TabChangeType change_type) OVERRIDE; 91 TabChangeType change_type) OVERRIDE;
93 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 92 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
94 TabContentsWrapper* old_contents, 93 TabContents* old_contents,
95 TabContentsWrapper* new_contents, 94 TabContents* new_contents,
96 int model_index) OVERRIDE; 95 int model_index) OVERRIDE;
97 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, 96 virtual void TabPinnedStateChanged(TabContents* contents,
98 int model_index) OVERRIDE; 97 int model_index) OVERRIDE;
99 virtual void TabMiniStateChanged(TabContentsWrapper* contents, 98 virtual void TabMiniStateChanged(TabContents* contents,
100 int model_index) OVERRIDE; 99 int model_index) OVERRIDE;
101 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, 100 virtual void TabBlockedStateChanged(TabContents* contents,
102 int model_index) OVERRIDE; 101 int model_index) OVERRIDE;
103 102
104 // content::NotificationObserver implementation: 103 // content::NotificationObserver implementation:
105 virtual void Observe(int type, 104 virtual void Observe(int type,
106 const content::NotificationSource& source, 105 const content::NotificationSource& source,
107 const content::NotificationDetails& details) OVERRIDE; 106 const content::NotificationDetails& details) OVERRIDE;
108 107
109 protected: 108 protected:
110 // The context in which SetTabRendererDataFromModel is being called. 109 // The context in which SetTabRendererDataFromModel is being called.
111 enum TabStatus { 110 enum TabStatus {
(...skipping 10 matching lines...) Expand all
122 Profile* profile() const { return model_->profile(); } 121 Profile* profile() const { return model_->profile(); }
123 122
124 const TabStrip* tabstrip() const { return tabstrip_; } 123 const TabStrip* tabstrip() const { return tabstrip_; }
125 124
126 const Browser* browser() const { return browser_; } 125 const Browser* browser() const { return browser_; }
127 126
128 private: 127 private:
129 class TabContextMenuContents; 128 class TabContextMenuContents;
130 129
131 // Invokes tabstrip_->SetTabData. 130 // Invokes tabstrip_->SetTabData.
132 void SetTabDataAt(TabContentsWrapper* contents, int model_index); 131 void SetTabDataAt(TabContents* contents, int model_index);
133 132
134 void StartHighlightTabsForCommand( 133 void StartHighlightTabsForCommand(
135 TabStripModel::ContextMenuCommand command_id, 134 TabStripModel::ContextMenuCommand command_id,
136 BaseTab* tab); 135 BaseTab* tab);
137 void StopHighlightTabsForCommand( 136 void StopHighlightTabsForCommand(
138 TabStripModel::ContextMenuCommand command_id, 137 TabStripModel::ContextMenuCommand command_id,
139 BaseTab* tab); 138 BaseTab* tab);
140 139
141 // Adds a tab. 140 // Adds a tab.
142 void AddTab(TabContentsWrapper* contents, int index, bool is_active); 141 void AddTab(TabContents* contents, int index, bool is_active);
143 142
144 // Resets the tabstrips layout type from prefs. 143 // Resets the tabstrips layout type from prefs.
145 void UpdateLayoutType(); 144 void UpdateLayoutType();
146 145
147 TabStripModel* model_; 146 TabStripModel* model_;
148 147
149 TabStrip* tabstrip_; 148 TabStrip* tabstrip_;
150 149
151 // Non-owning pointer to the browser which is using this controller. 150 // Non-owning pointer to the browser which is using this controller.
152 Browser* browser_; 151 Browser* browser_;
153 152
154 // If non-NULL it means we're showing a menu for the tab. 153 // If non-NULL it means we're showing a menu for the tab.
155 scoped_ptr<TabContextMenuContents> context_menu_contents_; 154 scoped_ptr<TabContextMenuContents> context_menu_contents_;
156 155
157 content::NotificationRegistrar notification_registrar_; 156 content::NotificationRegistrar notification_registrar_;
158 157
159 // Helper for performing tab selection as a result of dragging over a tab. 158 // Helper for performing tab selection as a result of dragging over a tab.
160 HoverTabSelector hover_tab_selector_; 159 HoverTabSelector hover_tab_selector_;
161 160
162 PrefChangeRegistrar local_pref_registrar_; 161 PrefChangeRegistrar local_pref_registrar_;
163 162
164 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController); 163 DISALLOW_COPY_AND_ASSIGN(BrowserTabStripController);
165 }; 164 };
166 165
167 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_ 166 #endif // CHROME_BROWSER_UI_VIEWS_TABS_BROWSER_TAB_STRIP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698