| 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/app/theme/theme_resources.h" | 8 #include "chrome/app/theme/theme_resources.h" |
| 9 #include "chrome/browser/metrics/user_metrics.h" | 9 #include "chrome/browser/metrics/user_metrics.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 } | 899 } |
| 900 | 900 |
| 901 void TabStrip::TabChangedAt(TabContents* contents, int index) { | 901 void TabStrip::TabChangedAt(TabContents* contents, int index) { |
| 902 // Index is in terms of the model. Need to make sure we adjust that index in | 902 // Index is in terms of the model. Need to make sure we adjust that index in |
| 903 // case we have an animation going. | 903 // case we have an animation going. |
| 904 Tab* tab = GetTabAtAdjustForAnimation(index); | 904 Tab* tab = GetTabAtAdjustForAnimation(index); |
| 905 tab->UpdateData(contents); | 905 tab->UpdateData(contents); |
| 906 tab->UpdateFromModel(); | 906 tab->UpdateFromModel(); |
| 907 } | 907 } |
| 908 | 908 |
| 909 void TabStrip::TabClosingAt(TabContents* contents, int index) { |
| 910 Tab* last_tab = GetTabAt(GetTabCount() - 1); |
| 911 // Limit the width available to the TabStrip for laying out Tabs, so that |
| 912 // Tabs are not resized until a later time (when the mouse pointer leaves |
| 913 // the TabStrip). |
| 914 available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab); |
| 915 resize_layout_scheduled_ = true; |
| 916 } |
| 917 |
| 909 /////////////////////////////////////////////////////////////////////////////// | 918 /////////////////////////////////////////////////////////////////////////////// |
| 910 // TabStrip, Tab::Delegate implementation: | 919 // TabStrip, Tab::Delegate implementation: |
| 911 | 920 |
| 912 bool TabStrip::IsTabSelected(const Tab* tab) const { | 921 bool TabStrip::IsTabSelected(const Tab* tab) const { |
| 913 if (tab->closing()) | 922 if (tab->closing()) |
| 914 return false; | 923 return false; |
| 915 | 924 |
| 916 int tab_count = GetTabCount(); | 925 int tab_count = GetTabCount(); |
| 917 for (int i = 0, index = 0; i < tab_count; ++i, ++index) { | 926 for (int i = 0, index = 0; i < tab_count; ++i, ++index) { |
| 918 Tab* current_tab = GetTabAt(i); | 927 Tab* current_tab = GetTabAt(i); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 return last_tab->x() + last_tab->width(); | 1562 return last_tab->x() + last_tab->width(); |
| 1554 } | 1563 } |
| 1555 | 1564 |
| 1556 bool TabStrip::IsPointInTab(Tab* tab, | 1565 bool TabStrip::IsPointInTab(Tab* tab, |
| 1557 const gfx::Point& point_in_tabstrip_coords) { | 1566 const gfx::Point& point_in_tabstrip_coords) { |
| 1558 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1567 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
| 1559 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1568 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
| 1560 return tab->HitTest(point_in_tab_coords); | 1569 return tab->HitTest(point_in_tab_coords); |
| 1561 } | 1570 } |
| 1562 | 1571 |
| OLD | NEW |