Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/ui/views/tabs/base_tab_strip.cc

Issue 7057014: Variety of tweaks to View API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 bool BaseTabStrip::IsAnimating() const { 585 bool BaseTabStrip::IsAnimating() const {
586 return bounds_animator_.IsAnimating(); 586 return bounds_animator_.IsAnimating();
587 } 587 }
588 588
589 BaseTab* BaseTabStrip::GetTabAtLocal(const gfx::Point& local_point) { 589 BaseTab* BaseTabStrip::GetTabAtLocal(const gfx::Point& local_point) {
590 views::View* view = GetEventHandlerForPoint(local_point); 590 views::View* view = GetEventHandlerForPoint(local_point);
591 if (!view) 591 if (!view)
592 return NULL; // No tab contains the point. 592 return NULL; // No tab contains the point.
593 593
594 // Walk up the view hierarchy until we find a tab, or the TabStrip. 594 // Walk up the view hierarchy until we find a tab, or the TabStrip.
595 while (view && view != this && view->GetID() != VIEW_ID_TAB) 595 while (view && view != this && view->id() != VIEW_ID_TAB)
596 view = view->parent(); 596 view = view->parent();
597 597
598 return view && view->GetID() == VIEW_ID_TAB ? 598 return view && view->id() == VIEW_ID_TAB ?
599 static_cast<BaseTab*>(view) : NULL; 599 static_cast<BaseTab*>(view) : NULL;
600 } 600 }
601 601
602 void BaseTabStrip::StoppedDraggingTab(BaseTab* tab, bool* is_first_tab) { 602 void BaseTabStrip::StoppedDraggingTab(BaseTab* tab, bool* is_first_tab) {
603 int tab_data_index = TabIndexOfTab(tab); 603 int tab_data_index = TabIndexOfTab(tab);
604 if (tab_data_index == -1) { 604 if (tab_data_index == -1) {
605 // The tab was removed before the drag completed. Don't do anything. 605 // The tab was removed before the drag completed. Don't do anything.
606 return; 606 return;
607 } 607 }
608 608
609 if (*is_first_tab) { 609 if (*is_first_tab) {
610 *is_first_tab = false; 610 *is_first_tab = false;
611 PrepareForAnimation(); 611 PrepareForAnimation();
612 612
613 // Animate the view back to its correct position. 613 // Animate the view back to its correct position.
614 GenerateIdealBounds(); 614 GenerateIdealBounds();
615 AnimateToIdealBounds(); 615 AnimateToIdealBounds();
616 } 616 }
617 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab))); 617 bounds_animator_.AnimateViewTo(tab, ideal_bounds(TabIndexOfTab(tab)));
618 // Install a delegate to reset the dragging state when done. We have to leave 618 // Install a delegate to reset the dragging state when done. We have to leave
619 // dragging true for the tab otherwise it'll draw beneath the new tab button. 619 // dragging true for the tab otherwise it'll draw beneath the new tab button.
620 bounds_animator_.SetAnimationDelegate( 620 bounds_animator_.SetAnimationDelegate(
621 tab, new ResetDraggingStateDelegate(tab), true); 621 tab, new ResetDraggingStateDelegate(tab), true);
622 } 622 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/base_tab.cc ('k') | chrome/browser/ui/views/tabs/side_tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698