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_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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "ui/views/widget/widget.h" | 44 #include "ui/views/widget/widget.h" |
45 #include "ui/views/window/non_client_view.h" | 45 #include "ui/views/window/non_client_view.h" |
46 | 46 |
47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
48 #include "ui/base/win/hwnd_util.h" | 48 #include "ui/base/win/hwnd_util.h" |
49 #include "ui/views/widget/monitor_win.h" | 49 #include "ui/views/widget/monitor_win.h" |
50 #endif | 50 #endif |
51 | 51 |
52 using views::DropTargetEvent; | 52 using views::DropTargetEvent; |
53 | 53 |
| 54 // Offset for the new tab button to bring it closer to the rightmost tab. |
| 55 #if defined(USE_ASH) |
| 56 static const int kNewTabButtonHOffset = -11; |
| 57 static const int kNewTabButtonVOffset = 7; |
| 58 #else |
54 static const int kNewTabButtonHOffset = -5; | 59 static const int kNewTabButtonHOffset = -5; |
55 static const int kNewTabButtonVOffset = 5; | 60 static const int kNewTabButtonVOffset = 5; |
56 static const int kSuspendAnimationsTimeMs = 200; | 61 #endif |
| 62 // Amount the left edge of a tab is offset from the rectangle of the tab's |
| 63 // favicon/title/close box. Related to the width of IDR_TAB_ACTIVE_LEFT. |
| 64 #if defined(USE_ASH) |
| 65 static const int kTabHOffset = -28; |
| 66 #else |
57 static const int kTabHOffset = -16; | 67 static const int kTabHOffset = -16; |
| 68 #endif |
58 static const int kTabStripAnimationVSlop = 40; | 69 static const int kTabStripAnimationVSlop = 40; |
59 // Inactive tabs in a native frame are slightly transparent. | 70 // Inactive tabs in a native frame are slightly transparent. |
60 static const int kNativeFrameInactiveTabAlpha = 200; | 71 static const int kNativeFrameInactiveTabAlpha = 200; |
61 // If there are multiple tabs selected then make non-selected inactive tabs | 72 // If there are multiple tabs selected then make non-selected inactive tabs |
62 // even more transparent. | 73 // even more transparent. |
63 static const int kNativeFrameInactiveTabAlphaMultiSelection = 150; | 74 static const int kNativeFrameInactiveTabAlphaMultiSelection = 150; |
64 | 75 |
65 // Inverse ratio of the width of a tab edge to the width of the tab. When | 76 // Inverse ratio of the width of a tab edge to the width of the tab. When |
66 // hovering over the left or right edge of a tab, the drop indicator will | 77 // hovering over the left or right edge of a tab, the drop indicator will |
67 // point between tabs. | 78 // point between tabs. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 173 } |
163 | 174 |
164 void NewTabButton::GetHitTestMask(gfx::Path* path) const { | 175 void NewTabButton::GetHitTestMask(gfx::Path* path) const { |
165 DCHECK(path); | 176 DCHECK(path); |
166 | 177 |
167 SkScalar w = SkIntToScalar(width()); | 178 SkScalar w = SkIntToScalar(width()); |
168 | 179 |
169 // These values are defined by the shape of the new tab bitmap. Should that | 180 // These values are defined by the shape of the new tab bitmap. Should that |
170 // bitmap ever change, these values will need to be updated. They're so | 181 // bitmap ever change, these values will need to be updated. They're so |
171 // custom it's not really worth defining constants for. | 182 // custom it's not really worth defining constants for. |
| 183 // These values are correct for regular and USE_ASH versions of the bitmap. |
172 path->moveTo(0, 1); | 184 path->moveTo(0, 1); |
173 path->lineTo(w - 7, 1); | 185 path->lineTo(w - 7, 1); |
174 path->lineTo(w - 4, 4); | 186 path->lineTo(w - 4, 4); |
175 path->lineTo(w, 16); | 187 path->lineTo(w, 16); |
176 path->lineTo(w - 1, 17); | 188 path->lineTo(w - 1, 17); |
177 path->lineTo(7, 17); | 189 path->lineTo(7, 17); |
178 path->lineTo(4, 13); | 190 path->lineTo(4, 13); |
179 path->lineTo(0, 1); | 191 path->lineTo(0, 1); |
180 path->close(); | 192 path->close(); |
181 } | 193 } |
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1910 ui::AnimationDelegate* TabStrip::CreateRemoveTabDelegate(BaseTab* tab) { | 1922 ui::AnimationDelegate* TabStrip::CreateRemoveTabDelegate(BaseTab* tab) { |
1911 return new RemoveTabDelegate(this, tab); | 1923 return new RemoveTabDelegate(this, tab); |
1912 } | 1924 } |
1913 | 1925 |
1914 bool TabStrip::IsPointInTab(Tab* tab, | 1926 bool TabStrip::IsPointInTab(Tab* tab, |
1915 const gfx::Point& point_in_tabstrip_coords) { | 1927 const gfx::Point& point_in_tabstrip_coords) { |
1916 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1928 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
1917 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1929 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
1918 return tab->HitTest(point_in_tab_coords); | 1930 return tab->HitTest(point_in_tab_coords); |
1919 } | 1931 } |
OLD | NEW |