| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/shelf/shelf_view.h" | 5 #include "ash/common/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| (...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 | 1053 |
| 1054 void ShelfView::AnimateToIdealBounds() { | 1054 void ShelfView::AnimateToIdealBounds() { |
| 1055 IdealBounds ideal_bounds; | 1055 IdealBounds ideal_bounds; |
| 1056 CalculateIdealBounds(&ideal_bounds); | 1056 CalculateIdealBounds(&ideal_bounds); |
| 1057 for (int i = 0; i < view_model_->view_size(); ++i) { | 1057 for (int i = 0; i < view_model_->view_size(); ++i) { |
| 1058 View* view = view_model_->view_at(i); | 1058 View* view = view_model_->view_at(i); |
| 1059 bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i)); | 1059 bounds_animator_->AnimateViewTo(view, view_model_->ideal_bounds(i)); |
| 1060 // Now that the item animation starts, we have to make sure that the | 1060 // Now that the item animation starts, we have to make sure that the |
| 1061 // padding of the first gets properly transferred to the new first item. | 1061 // padding of the first gets properly transferred to the new first item. |
| 1062 if (i && view->border()) | 1062 if (i && view->border()) |
| 1063 view->SetBorder(views::Border::NullBorder()); | 1063 view->SetBorder(views::NullBorder()); |
| 1064 } | 1064 } |
| 1065 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); | 1065 overflow_button_->SetBoundsRect(ideal_bounds.overflow_bounds); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 views::View* ShelfView::CreateViewForItem(const ShelfItem& item) { | 1068 views::View* ShelfView::CreateViewForItem(const ShelfItem& item) { |
| 1069 views::View* view = nullptr; | 1069 views::View* view = nullptr; |
| 1070 switch (item.type) { | 1070 switch (item.type) { |
| 1071 case TYPE_BROWSER_SHORTCUT: | 1071 case TYPE_BROWSER_SHORTCUT: |
| 1072 case TYPE_APP_SHORTCUT: | 1072 case TYPE_APP_SHORTCUT: |
| 1073 case TYPE_WINDOWED_APP: | 1073 case TYPE_WINDOWED_APP: |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1914 | 1914 |
| 1915 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1915 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1916 const gfx::Rect bounds = GetBoundsInScreen(); | 1916 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1917 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1917 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1918 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1918 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1919 bounds.x() - coordinate.x()); | 1919 bounds.x() - coordinate.x()); |
| 1920 return distance > 0 ? distance : 0; | 1920 return distance > 0 ? distance : 0; |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 } // namespace ash | 1923 } // namespace ash |
| OLD | NEW |