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 "ash/launcher/view_model_utils.h" | 5 #include "ash/launcher/view_model_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/launcher/view_model.h" | 9 #include "ash/launcher/view_model.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
11 | 11 |
12 namespace aura_shell { | 12 namespace ash { |
13 | 13 |
14 // static | 14 // static |
15 void ViewModelUtils::SetViewBoundsToIdealBounds(const ViewModel& model) { | 15 void ViewModelUtils::SetViewBoundsToIdealBounds(const ViewModel& model) { |
16 for (int i = 0; i < model.view_size(); ++i) | 16 for (int i = 0; i < model.view_size(); ++i) |
17 model.view_at(i)->SetBoundsRect(model.ideal_bounds(i)); | 17 model.view_at(i)->SetBoundsRect(model.ideal_bounds(i)); |
18 } | 18 } |
19 | 19 |
20 // static | 20 // static |
21 int ViewModelUtils::DetermineMoveIndex(const ViewModel& model, | 21 int ViewModelUtils::DetermineMoveIndex(const ViewModel& model, |
22 views::View* view, | 22 views::View* view, |
(...skipping 15 matching lines...) Expand all Loading... |
38 model.ideal_bounds(current_index).x(); | 38 model.ideal_bounds(current_index).x(); |
39 for (int i = current_index + 1; i < model.view_size(); ++i) { | 39 for (int i = current_index + 1; i < model.view_size(); ++i) { |
40 const gfx::Rect& bounds(model.ideal_bounds(i)); | 40 const gfx::Rect& bounds(model.ideal_bounds(i)); |
41 int mid_x = bounds.x() + bounds.width() / 2 - delta; | 41 int mid_x = bounds.x() + bounds.width() / 2 - delta; |
42 if (x < mid_x) | 42 if (x < mid_x) |
43 return i - 1; | 43 return i - 1; |
44 } | 44 } |
45 return model.view_size() - 1; | 45 return model.view_size() - 1; |
46 } | 46 } |
47 | 47 |
48 } // namespace aura_shell | 48 } // namespace ash |
OLD | NEW |