| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/tabs/tab_strip.h" | 5 #include "chrome/browser/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #include "base/gfx/size.h" | 7 #include "base/gfx/size.h" |
| 8 #include "chrome/browser/metrics/user_metrics.h" | 8 #include "chrome/browser/metrics/user_metrics.h" |
| 9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 496 } |
| 497 | 497 |
| 498 bool TabStrip::PointIsWithinWindowCaption(const gfx::Point& point) { | 498 bool TabStrip::PointIsWithinWindowCaption(const gfx::Point& point) { |
| 499 views::View* v = GetViewForPoint(point); | 499 views::View* v = GetViewForPoint(point); |
| 500 | 500 |
| 501 // If there is no control at this location, claim the hit was in the title | 501 // If there is no control at this location, claim the hit was in the title |
| 502 // bar to get a move action. | 502 // bar to get a move action. |
| 503 if (v == this) | 503 if (v == this) |
| 504 return true; | 504 return true; |
| 505 | 505 |
| 506 // If the point is within the bounds of a Tab, the point can be considered | |
| 507 // part of the caption if there are no available drag operations for the Tab. | |
| 508 if (v->GetClassName() == Tab::kTabClassName && !HasAvailableDragActions()) | |
| 509 return true; | |
| 510 | |
| 511 // Check to see if the point is within the non-button parts of the new tab | 506 // Check to see if the point is within the non-button parts of the new tab |
| 512 // button. The button has a non-rectangular shape, so if it's not in the | 507 // button. The button has a non-rectangular shape, so if it's not in the |
| 513 // visual portions of the button we treat it as a click to the caption. | 508 // visual portions of the button we treat it as a click to the caption. |
| 514 gfx::Point point_in_newtab_coords(point); | 509 gfx::Point point_in_newtab_coords(point); |
| 515 View::ConvertPointToView(this, newtab_button_, &point_in_newtab_coords); | 510 View::ConvertPointToView(this, newtab_button_, &point_in_newtab_coords); |
| 516 if (newtab_button_->bounds().Contains(point) && | 511 if (newtab_button_->bounds().Contains(point) && |
| 517 !newtab_button_->HitTest(point_in_newtab_coords)) { | 512 !newtab_button_->HitTest(point_in_newtab_coords)) { |
| 518 return true; | 513 return true; |
| 519 } | 514 } |
| 520 | 515 |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 // If the TabContents being detached was removed as a result of a drag | 1522 // If the TabContents being detached was removed as a result of a drag |
| 1528 // gesture from its corresponding Tab, we don't want to remove the Tab from | 1523 // gesture from its corresponding Tab, we don't want to remove the Tab from |
| 1529 // the child list, because if we do so it'll stop receiving events and the | 1524 // the child list, because if we do so it'll stop receiving events and the |
| 1530 // drag will stall. So we only remove if a drag isn't active, or the Tab | 1525 // drag will stall. So we only remove if a drag isn't active, or the Tab |
| 1531 // was for some other TabContents. | 1526 // was for some other TabContents. |
| 1532 if (!IsDragSessionActive() || !drag_controller_->IsDragSourceTab(removed)) { | 1527 if (!IsDragSessionActive() || !drag_controller_->IsDragSourceTab(removed)) { |
| 1533 removed->GetParent()->RemoveChildView(removed); | 1528 removed->GetParent()->RemoveChildView(removed); |
| 1534 delete removed; | 1529 delete removed; |
| 1535 } | 1530 } |
| 1536 } | 1531 } |
| OLD | NEW |