 Chromium Code Reviews
 Chromium Code Reviews| 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/base_tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "chrome/browser/ui/title_prefix_matcher.h" | 8 #include "chrome/browser/ui/title_prefix_matcher.h" | 
| 9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" | 
| 10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" | 10 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" | 
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 371 return false; | 371 return false; | 
| 372 bool started_drag = drag_controller_->started_drag(); | 372 bool started_drag = drag_controller_->started_drag(); | 
| 373 drag_controller_->EndDrag(canceled); | 373 drag_controller_->EndDrag(canceled); | 
| 374 return started_drag; | 374 return started_drag; | 
| 375 } | 375 } | 
| 376 | 376 | 
| 377 BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, | 377 BaseTab* BaseTabStrip::GetTabAt(BaseTab* tab, | 
| 378 const gfx::Point& tab_in_tab_coordinates) { | 378 const gfx::Point& tab_in_tab_coordinates) { | 
| 379 gfx::Point local_point = tab_in_tab_coordinates; | 379 gfx::Point local_point = tab_in_tab_coordinates; | 
| 380 ConvertPointToView(tab, this, &local_point); | 380 ConvertPointToView(tab, this, &local_point); | 
| 381 return GetTabAtLocal(local_point); | |
| 382 } | |
| 383 | |
| 384 BaseTab* BaseTabStrip::GetTabAtLocal( | |
| 
sky
2011/04/06 15:11:50
Position needs to match header.
 
wyck
2011/04/06 20:14:24
Yuck.  That's uniform, but disorganized.  But I'll
 | |
| 385 const gfx::Point& local_point) { | |
| 381 views::View* view = GetEventHandlerForPoint(local_point); | 386 views::View* view = GetEventHandlerForPoint(local_point); | 
| 382 if (!view) | 387 if (!view) | 
| 383 return NULL; // No tab contains the point. | 388 return NULL; // No tab contains the point. | 
| 384 | 389 | 
| 385 // Walk up the view hierarchy until we find a tab, or the TabStrip. | 390 // Walk up the view hierarchy until we find a tab, or the TabStrip. | 
| 386 while (view && view != this && view->GetID() != VIEW_ID_TAB) | 391 while (view && view != this && view->GetID() != VIEW_ID_TAB) | 
| 387 view = view->parent(); | 392 view = view->parent(); | 
| 388 | 393 | 
| 389 return view && view->GetID() == VIEW_ID_TAB ? | 394 return view && view->GetID() == VIEW_ID_TAB ? | 
| 390 static_cast<BaseTab*>(view) : NULL; | 395 static_cast<BaseTab*>(view) : NULL; | 
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 585 // Animate the view back to its correct position. | 590 // Animate the view back to its correct position. | 
| 586 GenerateIdealBounds(); | 591 GenerateIdealBounds(); | 
| 587 AnimateToIdealBounds(); | 592 AnimateToIdealBounds(); | 
| 588 } | 593 } | 
| 589 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); | 594 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); | 
| 590 // Install a delegate to reset the dragging state when done. We have to leave | 595 // Install a delegate to reset the dragging state when done. We have to leave | 
| 591 // dragging true for the tab otherwise it'll draw beneath the new tab button. | 596 // dragging true for the tab otherwise it'll draw beneath the new tab button. | 
| 592 bounds_animator_.SetAnimationDelegate( | 597 bounds_animator_.SetAnimationDelegate( | 
| 593 tab, new ResetDraggingStateDelegate(tab), true); | 598 tab, new ResetDraggingStateDelegate(tab), true); | 
| 594 } | 599 } | 
| OLD | NEW |