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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return !tab_strip_->SizeTabButtonToTopOfTabStrip(); | 83 return !tab_strip_->SizeTabButtonToTopOfTabStrip(); |
84 } | 84 } |
85 virtual void GetHitTestMask(gfx::Path* path) const { | 85 virtual void GetHitTestMask(gfx::Path* path) const { |
86 DCHECK(path); | 86 DCHECK(path); |
87 | 87 |
88 SkScalar w = SkIntToScalar(width()); | 88 SkScalar w = SkIntToScalar(width()); |
89 | 89 |
90 // These values are defined by the shape of the new tab bitmap. Should that | 90 // These values are defined by the shape of the new tab bitmap. Should that |
91 // bitmap ever change, these values will need to be updated. They're so | 91 // bitmap ever change, these values will need to be updated. They're so |
92 // custom it's not really worth defining constants for. | 92 // custom it's not really worth defining constants for. |
| 93 #if defined(TOUCH_UI) |
| 94 // touch_newtab.png size is different from newtab.png. |
| 95 // Change the values for TOUCH_UI as per touch_newtab.png. |
| 96 path->moveTo(0, 1); |
| 97 path->lineTo(w - 14, 1); |
| 98 path->lineTo(w - 10, 6); |
| 99 path->lineTo(w - 7, 28); |
| 100 path->lineTo(w - 1, 32); |
| 101 path->lineTo(11, 32); |
| 102 path->lineTo(7, 28); |
| 103 path->lineTo(0, 1); |
| 104 #else |
93 path->moveTo(0, 1); | 105 path->moveTo(0, 1); |
94 path->lineTo(w - 7, 1); | 106 path->lineTo(w - 7, 1); |
95 path->lineTo(w - 4, 4); | 107 path->lineTo(w - 4, 4); |
96 path->lineTo(w, 16); | 108 path->lineTo(w, 16); |
97 path->lineTo(w - 1, 17); | 109 path->lineTo(w - 1, 17); |
98 path->lineTo(7, 17); | 110 path->lineTo(7, 17); |
99 path->lineTo(4, 13); | 111 path->lineTo(4, 13); |
100 path->lineTo(0, 1); | 112 path->lineTo(0, 1); |
| 113 #endif |
101 path->close(); | 114 path->close(); |
102 } | 115 } |
103 | 116 |
104 private: | 117 private: |
105 // Tab strip that contains this button. | 118 // Tab strip that contains this button. |
106 TabStrip* tab_strip_; | 119 TabStrip* tab_strip_; |
107 | 120 |
108 DISALLOW_COPY_AND_ASSIGN(NewTabButton); | 121 DISALLOW_COPY_AND_ASSIGN(NewTabButton); |
109 }; | 122 }; |
110 | 123 |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 } | 1045 } |
1033 return mini_count; | 1046 return mini_count; |
1034 } | 1047 } |
1035 | 1048 |
1036 bool TabStrip::IsPointInTab(Tab* tab, | 1049 bool TabStrip::IsPointInTab(Tab* tab, |
1037 const gfx::Point& point_in_tabstrip_coords) { | 1050 const gfx::Point& point_in_tabstrip_coords) { |
1038 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1051 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
1039 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1052 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
1040 return tab->HitTest(point_in_tab_coords); | 1053 return tab->HitTest(point_in_tab_coords); |
1041 } | 1054 } |
OLD | NEW |