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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 // renders on top of adjacent tabs, it needs to be hit-tested before any | 1069 // renders on top of adjacent tabs, it needs to be hit-tested before any |
1070 // left-adjacent Tab, so we look ahead for it as we walk. | 1070 // left-adjacent Tab, so we look ahead for it as we walk. |
1071 for (int i = 0; i < tab_count(); ++i) { | 1071 for (int i = 0; i < tab_count(); ++i) { |
1072 Tab* next_tab = i < (tab_count() - 1) ? tab_at(i + 1) : NULL; | 1072 Tab* next_tab = i < (tab_count() - 1) ? tab_at(i + 1) : NULL; |
1073 if (next_tab && next_tab->IsActive() && IsPointInTab(next_tab, point)) | 1073 if (next_tab && next_tab->IsActive() && IsPointInTab(next_tab, point)) |
1074 return next_tab; | 1074 return next_tab; |
1075 if (IsPointInTab(tab_at(i), point)) | 1075 if (IsPointInTab(tab_at(i), point)) |
1076 return tab_at(i); | 1076 return tab_at(i); |
1077 } | 1077 } |
1078 } else { | 1078 } else { |
| 1079 if (newtab_button_->visible()) { |
| 1080 gfx::Point newtab_button_point(point); |
| 1081 View::ConvertPointToView(this, newtab_button_, &newtab_button_point); |
| 1082 if (newtab_button_->HitTest(newtab_button_point)) |
| 1083 return newtab_button_->GetEventHandlerForPoint(newtab_button_point); |
| 1084 } |
| 1085 |
1079 int active_tab_index = touch_layout_->active_index(); | 1086 int active_tab_index = touch_layout_->active_index(); |
1080 if (active_tab_index != -1) { | 1087 if (active_tab_index != -1) { |
1081 Tab* tab = FindTabForEvent(point, active_tab_index, -1); | 1088 Tab* tab = FindTabForEvent(point, active_tab_index, -1); |
1082 if (!tab) | 1089 if (!tab) |
1083 tab = FindTabForEvent(point, active_tab_index + 1, 1); | 1090 tab = FindTabForEvent(point, active_tab_index + 1, 1); |
1084 if (tab) { | 1091 if (tab) { |
1085 gfx::Point point_in_tab_coords(point); | 1092 gfx::Point point_in_tab_coords(point); |
1086 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1093 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
1087 return tab->GetEventHandlerForPoint(point_in_tab_coords); | 1094 return tab->GetEventHandlerForPoint(point_in_tab_coords); |
1088 } | 1095 } |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 } | 1944 } |
1938 return NULL; | 1945 return NULL; |
1939 } | 1946 } |
1940 | 1947 |
1941 std::vector<int> TabStrip::GetTabXCoordinates() { | 1948 std::vector<int> TabStrip::GetTabXCoordinates() { |
1942 std::vector<int> results; | 1949 std::vector<int> results; |
1943 for (int i = 0; i < tab_count(); ++i) | 1950 for (int i = 0; i < tab_count(); ++i) |
1944 results.push_back(ideal_bounds(i).x()); | 1951 results.push_back(ideal_bounds(i).x()); |
1945 return results; | 1952 return results; |
1946 } | 1953 } |
OLD | NEW |