| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "app/gfx/canvas.h" | 8 #include "app/gfx/canvas.h" |
| 9 #include "app/gfx/path.h" | 9 #include "app/gfx/path.h" |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 // the stopping of the active animation above may have left the TabStrip in a | 765 // the stopping of the active animation above may have left the TabStrip in a |
| 766 // bad (visual) state. | 766 // bad (visual) state. |
| 767 Layout(); | 767 Layout(); |
| 768 } | 768 } |
| 769 | 769 |
| 770 gfx::Rect TabStrip::GetIdealBounds(int index) { | 770 gfx::Rect TabStrip::GetIdealBounds(int index) { |
| 771 DCHECK(index >= 0 && index < GetTabCount()); | 771 DCHECK(index >= 0 && index < GetTabCount()); |
| 772 return tab_data_.at(index).ideal_bounds; | 772 return tab_data_.at(index).ideal_bounds; |
| 773 } | 773 } |
| 774 | 774 |
| 775 Tab* TabStrip::GetSelectedTab() const { |
| 776 return GetTabAtAdjustForAnimation(model()->selected_index()); |
| 777 } |
| 778 |
| 775 void TabStrip::InitTabStripButtons() { | 779 void TabStrip::InitTabStripButtons() { |
| 776 newtab_button_ = new NewTabButton(this); | 780 newtab_button_ = new NewTabButton(this); |
| 777 LoadNewTabButtonImage(); | 781 LoadNewTabButtonImage(); |
| 778 newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB)); | 782 newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB)); |
| 779 AddChildView(newtab_button_); | 783 AddChildView(newtab_button_); |
| 780 } | 784 } |
| 781 | 785 |
| 782 /////////////////////////////////////////////////////////////////////////////// | 786 /////////////////////////////////////////////////////////////////////////////// |
| 783 // TabStrip, views::View overrides: | 787 // TabStrip, views::View overrides: |
| 784 | 788 |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 HandleGlobalMouseMoveEvent(); | 1317 HandleGlobalMouseMoveEvent(); |
| 1314 break; | 1318 break; |
| 1315 default: | 1319 default: |
| 1316 break; | 1320 break; |
| 1317 } | 1321 } |
| 1318 } | 1322 } |
| 1319 #endif | 1323 #endif |
| 1320 | 1324 |
| 1321 //////////////////////////////////////////////////////////////////////////////// | 1325 //////////////////////////////////////////////////////////////////////////////// |
| 1322 // TabStrip, TabStripWrapper implementation: | 1326 // TabStrip, TabStripWrapper implementation: |
| 1323 | |
| 1324 int TabStrip::GetPreferredHeight() { | 1327 int TabStrip::GetPreferredHeight() { |
| 1325 return GetPreferredSize().height(); | 1328 return GetPreferredSize().height(); |
| 1326 } | 1329 } |
| 1327 | 1330 |
| 1328 bool TabStrip::IsAnimating() const { | 1331 bool TabStrip::IsAnimating() const { |
| 1329 return active_animation_.get() != NULL; | 1332 return active_animation_.get() != NULL; |
| 1330 } | 1333 } |
| 1331 | 1334 |
| 1332 void TabStrip::SetBackgroundOffset(gfx::Point offset) { | 1335 void TabStrip::SetBackgroundOffset(gfx::Point offset) { |
| 1333 int tab_count = GetTabCount(); | 1336 int tab_count = GetTabCount(); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1978 &TabStrip::ResizeLayoutTabs), | 1981 &TabStrip::ResizeLayoutTabs), |
| 1979 kResizeTabsTimeMs); | 1982 kResizeTabsTimeMs); |
| 1980 } | 1983 } |
| 1981 } else { | 1984 } else { |
| 1982 // Mouse moved quickly out of the tab strip and then into it again, so | 1985 // Mouse moved quickly out of the tab strip and then into it again, so |
| 1983 // cancel the timer so that the strip doesn't move when the mouse moves | 1986 // cancel the timer so that the strip doesn't move when the mouse moves |
| 1984 // back over it. | 1987 // back over it. |
| 1985 resize_layout_factory_.RevokeAll(); | 1988 resize_layout_factory_.RevokeAll(); |
| 1986 } | 1989 } |
| 1987 } | 1990 } |
| OLD | NEW |