OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 return !tab_strip_->SizeTabButtonToTopOfTabStrip(); | 84 return !tab_strip_->SizeTabButtonToTopOfTabStrip(); |
85 } | 85 } |
86 virtual void GetHitTestMask(gfx::Path* path) const { | 86 virtual void GetHitTestMask(gfx::Path* path) const { |
87 DCHECK(path); | 87 DCHECK(path); |
88 | 88 |
89 SkScalar w = SkIntToScalar(width()); | 89 SkScalar w = SkIntToScalar(width()); |
90 | 90 |
91 // These values are defined by the shape of the new tab bitmap. Should that | 91 // These values are defined by the shape of the new tab bitmap. Should that |
92 // bitmap ever change, these values will need to be updated. They're so | 92 // bitmap ever change, these values will need to be updated. They're so |
93 // custom it's not really worth defining constants for. | 93 // custom it's not really worth defining constants for. |
94 #if defined(TOUCH_UI) | |
95 // touch_newtab.png size is different from newtab.png. | |
96 // Change the values for TOUCH_UI as per touch_newtab.png. | |
97 path->moveTo(0, 1); | |
98 path->lineTo(w - 14, 1); | |
99 path->lineTo(w - 10, 6); | |
100 path->lineTo(w - 7, 28); | |
101 path->lineTo(w - 1, 32); | |
102 path->lineTo(11, 32); | |
103 path->lineTo(7, 28); | |
104 path->lineTo(0, 1); | |
105 #else | |
106 path->moveTo(0, 1); | 94 path->moveTo(0, 1); |
107 path->lineTo(w - 7, 1); | 95 path->lineTo(w - 7, 1); |
108 path->lineTo(w - 4, 4); | 96 path->lineTo(w - 4, 4); |
109 path->lineTo(w, 16); | 97 path->lineTo(w, 16); |
110 path->lineTo(w - 1, 17); | 98 path->lineTo(w - 1, 17); |
111 path->lineTo(7, 17); | 99 path->lineTo(7, 17); |
112 path->lineTo(4, 13); | 100 path->lineTo(4, 13); |
113 path->lineTo(0, 1); | 101 path->lineTo(0, 1); |
114 #endif | |
115 path->close(); | 102 path->close(); |
116 } | 103 } |
117 | 104 |
118 #if defined(OS_WIN) && !defined(USE_AURA) | 105 #if defined(OS_WIN) && !defined(USE_AURA) |
119 void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { | 106 void OnMouseReleased(const views::MouseEvent& event) OVERRIDE { |
120 if (event.IsOnlyRightMouseButton()) { | 107 if (event.IsOnlyRightMouseButton()) { |
121 gfx::Point point(event.x(), event.y()); | 108 gfx::Point point(event.x(), event.y()); |
122 views::View::ConvertPointToScreen(this, &point); | 109 views::View::ConvertPointToScreen(this, &point); |
123 ui::ShowSystemMenu(GetWidget()->GetNativeView(), point.x(), point.y()); | 110 ui::ShowSystemMenu(GetWidget()->GetNativeView(), point.x(), point.y()); |
124 SetState(BS_NORMAL); | 111 SetState(BS_NORMAL); |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 } | 1046 } |
1060 return mini_count; | 1047 return mini_count; |
1061 } | 1048 } |
1062 | 1049 |
1063 bool TabStrip::IsPointInTab(Tab* tab, | 1050 bool TabStrip::IsPointInTab(Tab* tab, |
1064 const gfx::Point& point_in_tabstrip_coords) { | 1051 const gfx::Point& point_in_tabstrip_coords) { |
1065 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1052 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
1066 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1053 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
1067 return tab->HitTest(point_in_tab_coords); | 1054 return tab->HitTest(point_in_tab_coords); |
1068 } | 1055 } |
OLD | NEW |