| 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/side_tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" |
| 6 | 6 |
| 7 #include "chrome/browser/tabs/tab_strip_selection_model.h" |
| 7 #include "chrome/browser/ui/view_ids.h" | 8 #include "chrome/browser/ui/view_ids.h" |
| 8 #include "chrome/browser/ui/views/tabs/side_tab.h" | 9 #include "chrome/browser/ui/views/tabs/side_tab.h" |
| 9 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" | 10 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" |
| 10 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 11 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 12 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 14 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
| 15 #include "views/background.h" | 16 #include "views/background.h" |
| 16 #include "views/controls/button/image_button.h" | 17 #include "views/controls/button/image_button.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // Make sure the dragged tab shares our theme provider. We need to explicitly | 169 // Make sure the dragged tab shares our theme provider. We need to explicitly |
| 169 // do this as during dragging there isn't a theme provider. | 170 // do this as during dragging there isn't a theme provider. |
| 170 tab->set_theme_provider(GetThemeProvider()); | 171 tab->set_theme_provider(GetThemeProvider()); |
| 171 return tab; | 172 return tab; |
| 172 } | 173 } |
| 173 | 174 |
| 174 void SideTabStrip::RemoveTabAt(int model_index) { | 175 void SideTabStrip::RemoveTabAt(int model_index) { |
| 175 StartRemoveTabAnimation(model_index); | 176 StartRemoveTabAnimation(model_index); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void SideTabStrip::SelectTabAt(int old_model_index, int new_model_index) { | 179 void SideTabStrip::SetSelection(const TabStripSelectionModel& old_selection, |
| 179 GetBaseTabAtModelIndex(new_model_index)->SchedulePaint(); | 180 const TabStripSelectionModel& new_selection) { |
| 180 | 181 GetBaseTabAtModelIndex(new_selection.active())->SchedulePaint(); |
| 181 if (controller()->IsActiveTab(new_model_index)) | 182 if (old_selection.active() != new_selection.active()) |
| 182 MakeTabVisible(ModelIndexToTabIndex(new_model_index)); | 183 MakeTabVisible(ModelIndexToTabIndex(new_selection.active())); |
| 183 } | 184 } |
| 184 | 185 |
| 185 void SideTabStrip::TabTitleChangedNotLoading(int model_index) { | 186 void SideTabStrip::TabTitleChangedNotLoading(int model_index) { |
| 186 } | 187 } |
| 187 | 188 |
| 188 gfx::Size SideTabStrip::GetPreferredSize() { | 189 gfx::Size SideTabStrip::GetPreferredSize() { |
| 189 return gfx::Size(kTabStripWidth, 0); | 190 return gfx::Size(kTabStripWidth, 0); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void SideTabStrip::PaintChildren(gfx::Canvas* canvas) { | 193 void SideTabStrip::PaintChildren(gfx::Canvas* canvas) { |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 return; | 459 return; |
| 459 | 460 |
| 460 if (ideal_bounds(tab_index).y() < kTabStripInset) { | 461 if (ideal_bounds(tab_index).y() < kTabStripInset) { |
| 461 SetFirstTabYOffset(first_tab_y_offset_ - ideal_bounds(tab_index).y() + | 462 SetFirstTabYOffset(first_tab_y_offset_ - ideal_bounds(tab_index).y() + |
| 462 kTabStripInset); | 463 kTabStripInset); |
| 463 } else if (ideal_bounds(tab_index).bottom() > GetMaxTabY()) { | 464 } else if (ideal_bounds(tab_index).bottom() > GetMaxTabY()) { |
| 464 SetFirstTabYOffset(GetMaxTabY() - (ideal_bounds(tab_index).bottom() - | 465 SetFirstTabYOffset(GetMaxTabY() - (ideal_bounds(tab_index).bottom() - |
| 465 first_tab_y_offset_)); | 466 first_tab_y_offset_)); |
| 466 } | 467 } |
| 467 } | 468 } |
| OLD | NEW |