Lines Matching refs:tab

5 #include "chrome/browser/ui/views/tabs/tab.h"
33 virtual void SelectTab(Tab* tab) OVERRIDE {}
34 virtual void ExtendSelectionTo(Tab* tab) OVERRIDE {}
35 virtual void ToggleSelected(Tab* tab) OVERRIDE {}
36 virtual void AddSelectionFromAnchorTo(Tab* tab) OVERRIDE {}
37 virtual void CloseTab(Tab* tab, CloseTabSource source) OVERRIDE {}
38 virtual void ToggleTabAudioMute(Tab* tab) OVERRIDE {}
39 virtual void ShowContextMenuForTab(Tab* tab,
42 virtual bool IsActiveTab(const Tab* tab) const OVERRIDE {
45 virtual bool IsTabSelected(const Tab* tab) const OVERRIDE {
48 virtual bool IsTabPinned(const Tab* tab) const OVERRIDE { return false; }
50 Tab* tab,
56 virtual Tab* GetTabAt(Tab* tab,
62 virtual bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) OVERRIDE {
66 virtual void UpdateTabAccessibilityState(const Tab* tab,
99 static void CheckForExpectedLayoutAndVisibilityOfElements(const Tab& tab) {
102 if (tab.data_.mini) {
103 EXPECT_EQ(1, tab.IconCapacity());
104 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) {
105 EXPECT_FALSE(tab.ShouldShowIcon());
106 EXPECT_TRUE(tab.ShouldShowMediaIndicator());
108 EXPECT_TRUE(tab.ShouldShowIcon());
109 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
111 EXPECT_FALSE(tab.ShouldShowCloseBox());
112 } else if (tab.IsActive()) {
113 EXPECT_TRUE(tab.ShouldShowCloseBox());
114 switch (tab.IconCapacity()) {
117 EXPECT_FALSE(tab.ShouldShowIcon());
118 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
121 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) {
122 EXPECT_FALSE(tab.ShouldShowIcon());
123 EXPECT_TRUE(tab.ShouldShowMediaIndicator());
125 EXPECT_TRUE(tab.ShouldShowIcon());
126 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
130 EXPECT_LE(3, tab.IconCapacity());
131 EXPECT_TRUE(tab.ShouldShowIcon());
132 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE)
133 EXPECT_TRUE(tab.ShouldShowMediaIndicator());
135 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
138 } else { // Tab not active and not mini tab.
139 switch (tab.IconCapacity()) {
141 EXPECT_FALSE(tab.ShouldShowCloseBox());
142 EXPECT_FALSE(tab.ShouldShowIcon());
143 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
146 EXPECT_FALSE(tab.ShouldShowCloseBox());
147 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE) {
148 EXPECT_FALSE(tab.ShouldShowIcon());
149 EXPECT_TRUE(tab.ShouldShowMediaIndicator());
151 EXPECT_TRUE(tab.ShouldShowIcon());
152 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
156 EXPECT_LE(2, tab.IconCapacity());
157 EXPECT_TRUE(tab.ShouldShowIcon());
158 if (tab.data_.media_state != TAB_MEDIA_STATE_NONE)
159 EXPECT_TRUE(tab.ShouldShowMediaIndicator());
161 EXPECT_FALSE(tab.ShouldShowMediaIndicator());
168 const gfx::Rect contents_bounds = tab.GetContentsBounds();
169 if (tab.ShouldShowIcon()) {
170 EXPECT_LE(contents_bounds.x(), tab.favicon_bounds_.x());
171 if (tab.title_->width() > 0)
172 EXPECT_LE(tab.favicon_bounds_.right(), tab.title_->x());
173 EXPECT_LE(contents_bounds.y(), tab.favicon_bounds_.y());
174 EXPECT_LE(tab.favicon_bounds_.bottom(), contents_bounds.bottom());
176 if (tab.ShouldShowIcon() && tab.ShouldShowMediaIndicator())
177 EXPECT_LE(tab.favicon_bounds_.right(), GetMediaIndicatorBounds(tab).x());
178 if (tab.ShouldShowMediaIndicator()) {
179 if (tab.title_->width() > 0) {
180 EXPECT_LE(tab.title_->bounds().right(),
181 GetMediaIndicatorBounds(tab).x());
183 EXPECT_LE(GetMediaIndicatorBounds(tab).right(), contents_bounds.right());
184 EXPECT_LE(contents_bounds.y(), GetMediaIndicatorBounds(tab).y());
185 EXPECT_LE(GetMediaIndicatorBounds(tab).bottom(),
188 if (tab.ShouldShowMediaIndicator() && tab.ShouldShowCloseBox()) {
191 EXPECT_LE(GetMediaIndicatorBounds(tab).right(),
192 tab.close_button_->bounds().x() +
193 tab.close_button_->GetInsets().left());
195 if (tab.ShouldShowCloseBox()) {
198 if (tab.title_->width() > 0) {
199 EXPECT_LE(tab.title_->bounds().right(),
200 tab.close_button_->bounds().x() +
201 tab.close_button_->GetInsets().left());
203 EXPECT_LE(tab.close_button_->bounds().right(), contents_bounds.right());
204 EXPECT_LE(contents_bounds.y(), tab.close_button_->bounds().y());
205 EXPECT_LE(tab.close_button_->bounds().bottom(), contents_bounds.bottom());
210 static gfx::Rect GetMediaIndicatorBounds(const Tab& tab) {
211 if (!tab.media_indicator_button_) {
215 return tab.media_indicator_button_->bounds();
234 Tab tab(&tab_controller);
235 widget.GetContentsView()->AddChildView(&tab);
236 tab.SetBoundsRect(gfx::Rect(gfx::Point(0, 0), Tab::GetStandardSize()));
238 // Tabs have some shadow in the top, so by default we don't hit the tab there.
239 int middle_x = tab.width() / 2;
240 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(middle_x, 0)));
243 int middle_y = tab.height() / 2;
244 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(0, middle_y)));
247 // select the tab.
249 EXPECT_TRUE(tab.HitTestPoint(gfx::Point(middle_x, 0)));
252 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(0, 0)));
253 EXPECT_FALSE(tab.HitTestPoint(gfx::Point(tab.width() - 1, 0)));
268 Tab tab(&controller);
291 tab.SetData(data);
305 tab.SetBoundsRect(bounds); // Invokes Tab::Layout().
306 CheckForExpectedLayoutAndVisibilityOfElements(tab);
323 Tab tab(&tab_controller);
324 tab.SetBounds(0, 0, 100, 50);
325 tab.Layout();
326 gfx::Insets close_button_insets = tab.close_button_->GetInsets();
327 tab.Layout();
328 gfx::Insets close_button_insets_2 = tab.close_button_->GetInsets();
334 // Also make sure the close button is sized as large as the tab.
335 EXPECT_EQ(50, tab.close_button_->bounds().height());