| 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/grid.h" | 5 #include "chrome/browser/views/tabs/grid.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 | 8 |
| 9 using views::View; | 9 using views::View; |
| 10 | 10 |
| 11 //static | 11 //static |
| 12 const int Grid::kCellXPadding = 15; | 12 const int Grid::kCellXPadding = 15; |
| 13 // static | 13 // static |
| 14 const int Grid::kCellYPadding = 15; | 14 const int Grid::kCellYPadding = 15; |
| 15 | 15 |
| 16 Grid::Grid() | 16 Grid::Grid() |
| 17 : ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), | 17 : ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), |
| 18 modifying_children_(false), | 18 modifying_children_(false), |
| 19 needs_layout_(false), | 19 needs_layout_(false), |
| 20 pref_width_(0), | 20 pref_width_(0), |
| 21 pref_height_(0), | 21 pref_height_(0), |
| 22 cell_width_(0), | 22 cell_width_(0), |
| 23 cell_height_(0), | 23 cell_height_(0), |
| 24 columns_(0), | 24 columns_(0), |
| 25 rows_(0), | 25 rows_(0), |
| 26 floating_index_(-1) { | 26 floating_index_(-1) { |
| 27 animation_.SetTweenType(SlideAnimation::EASE_OUT); |
| 27 } | 28 } |
| 28 | 29 |
| 29 void Grid::MoveCell(int old_index, int new_index) { | 30 void Grid::MoveCell(int old_index, int new_index) { |
| 30 View* cell = GetChildViewAt(old_index); | 31 View* cell = GetChildViewAt(old_index); |
| 31 modifying_children_ = true; | 32 modifying_children_ = true; |
| 32 RemoveChildView(cell); | 33 RemoveChildView(cell); |
| 33 AddChildView(new_index, cell); | 34 AddChildView(new_index, cell); |
| 34 modifying_children_ = false; | 35 modifying_children_ = false; |
| 35 | 36 |
| 36 CalculateTargetBoundsAndStartAnimation(); | 37 CalculateTargetBoundsAndStartAnimation(); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 animation_.Show(); | 240 animation_.Show(); |
| 240 } | 241 } |
| 241 | 242 |
| 242 void Grid::SetViewBoundsToTarget() { | 243 void Grid::SetViewBoundsToTarget() { |
| 243 DCHECK(GetChildViewCount() == static_cast<int>(target_bounds_.size())); | 244 DCHECK(GetChildViewCount() == static_cast<int>(target_bounds_.size())); |
| 244 for (size_t i = 0; i < target_bounds_.size(); ++i) { | 245 for (size_t i = 0; i < target_bounds_.size(); ++i) { |
| 245 if (static_cast<int>(i) != floating_index_) | 246 if (static_cast<int>(i) != floating_index_) |
| 246 GetChildViewAt(i)->SetBounds(target_bounds_[i]); | 247 GetChildViewAt(i)->SetBounds(target_bounds_[i]); |
| 247 } | 248 } |
| 248 } | 249 } |
| OLD | NEW |