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 #include "chrome/browser/ui/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 paint_throbber_to_layer_ = value; | 32 paint_throbber_to_layer_ = value; |
33 } | 33 } |
34 | 34 |
35 const ui::ListSelectionModel& GetSelectionModel() const override { | 35 const ui::ListSelectionModel& GetSelectionModel() const override { |
36 return selection_model_; | 36 return selection_model_; |
37 } | 37 } |
38 bool SupportsMultipleSelection() override { return false; } | 38 bool SupportsMultipleSelection() override { return false; } |
39 bool ShouldHideCloseButtonForInactiveTabs() override { | 39 bool ShouldHideCloseButtonForInactiveTabs() override { |
40 return false; | 40 return false; |
41 } | 41 } |
| 42 bool MaySetClip() override { return false; } |
42 void SelectTab(Tab* tab) override {} | 43 void SelectTab(Tab* tab) override {} |
43 void ExtendSelectionTo(Tab* tab) override {} | 44 void ExtendSelectionTo(Tab* tab) override {} |
44 void ToggleSelected(Tab* tab) override {} | 45 void ToggleSelected(Tab* tab) override {} |
45 void AddSelectionFromAnchorTo(Tab* tab) override {} | 46 void AddSelectionFromAnchorTo(Tab* tab) override {} |
46 void CloseTab(Tab* tab, CloseTabSource source) override {} | 47 void CloseTab(Tab* tab, CloseTabSource source) override {} |
47 void ToggleTabAudioMute(Tab* tab) override {} | 48 void ToggleTabAudioMute(Tab* tab) override {} |
48 void ShowContextMenuForTab(Tab* tab, | 49 void ShowContextMenuForTab(Tab* tab, |
49 const gfx::Point& p, | 50 const gfx::Point& p, |
50 ui::MenuSourceType source_type) override {} | 51 ui::MenuSourceType source_type) override {} |
51 bool IsActiveTab(const Tab* tab) const override { return active_tab_; } | 52 bool IsActiveTab(const Tab* tab) const override { return active_tab_; } |
52 bool IsTabSelected(const Tab* tab) const override { return false; } | 53 bool IsTabSelected(const Tab* tab) const override { return false; } |
53 bool IsTabPinned(const Tab* tab) const override { return false; } | 54 bool IsTabPinned(const Tab* tab) const override { return false; } |
54 void MaybeStartDrag( | 55 void MaybeStartDrag( |
55 Tab* tab, | 56 Tab* tab, |
56 const ui::LocatedEvent& event, | 57 const ui::LocatedEvent& event, |
57 const ui::ListSelectionModel& original_selection) override {} | 58 const ui::ListSelectionModel& original_selection) override {} |
58 void ContinueDrag(views::View* view, const ui::LocatedEvent& event) override { | 59 void ContinueDrag(views::View* view, const ui::LocatedEvent& event) override { |
59 } | 60 } |
60 bool EndDrag(EndDragReason reason) override { return false; } | 61 bool EndDrag(EndDragReason reason) override { return false; } |
61 Tab* GetTabAt(Tab* tab, const gfx::Point& tab_in_tab_coordinates) override { | 62 Tab* GetTabAt(Tab* tab, const gfx::Point& tab_in_tab_coordinates) override { |
62 return NULL; | 63 return NULL; |
63 } | 64 } |
64 void OnMouseEventInTab(views::View* source, | 65 void OnMouseEventInTab(views::View* source, |
65 const ui::MouseEvent& event) override {} | 66 const ui::MouseEvent& event) override {} |
66 bool ShouldPaintTab(const Tab* tab, gfx::Rect* clip) override { return true; } | 67 bool ShouldPaintTab( |
| 68 const Tab* tab, |
| 69 const base::Callback<gfx::Path(const gfx::Size&)>& border_callback, |
| 70 gfx::Path* clip) override { |
| 71 return true; |
| 72 } |
67 bool CanPaintThrobberToLayer() const override { | 73 bool CanPaintThrobberToLayer() const override { |
68 return paint_throbber_to_layer_; | 74 return paint_throbber_to_layer_; |
69 } | 75 } |
70 bool IsImmersiveStyle() const override { return immersive_style_; } | 76 bool IsImmersiveStyle() const override { return immersive_style_; } |
71 SkColor GetToolbarTopSeparatorColor() const override { return SK_ColorBLACK; } | 77 SkColor GetToolbarTopSeparatorColor() const override { return SK_ColorBLACK; } |
72 int GetBackgroundResourceId(bool* custom_image) const override { | 78 int GetBackgroundResourceId(bool* custom_image) const override { |
73 *custom_image = false; | 79 *custom_image = false; |
74 return IDR_THEME_TAB_BACKGROUND; | 80 return IDR_THEME_TAB_BACKGROUND; |
75 } | 81 } |
76 void UpdateTabAccessibilityState(const Tab* tab, | 82 void UpdateTabAccessibilityState(const Tab* tab, |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 490 } |
485 | 491 |
486 TEST_F(TabTest, TitleHiddenWhenSmall) { | 492 TEST_F(TabTest, TitleHiddenWhenSmall) { |
487 FakeTabController tab_controller; | 493 FakeTabController tab_controller; |
488 Tab tab(&tab_controller, nullptr); | 494 Tab tab(&tab_controller, nullptr); |
489 tab.SetBounds(0, 0, 100, 50); | 495 tab.SetBounds(0, 0, 100, 50); |
490 EXPECT_GT(GetTitleWidth(tab), 0); | 496 EXPECT_GT(GetTitleWidth(tab), 0); |
491 tab.SetBounds(0, 0, 0, 50); | 497 tab.SetBounds(0, 0, 0, 50); |
492 EXPECT_EQ(0, GetTitleWidth(tab)); | 498 EXPECT_EQ(0, GetTitleWidth(tab)); |
493 } | 499 } |
OLD | NEW |