| 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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 // get remembered and restored after the insertion to the previous value. | 1702 // get remembered and restored after the insertion to the previous value. |
| 1703 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index); | 1703 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index); |
| 1704 view_model_->Remove(model_index); | 1704 view_model_->Remove(model_index); |
| 1705 views::View* new_view = CreateViewForItem(item); | 1705 views::View* new_view = CreateViewForItem(item); |
| 1706 AddChildView(new_view); | 1706 AddChildView(new_view); |
| 1707 view_model_->Add(new_view, model_index); | 1707 view_model_->Add(new_view, model_index); |
| 1708 view_model_->set_ideal_bounds(model_index, old_ideal_bounds); | 1708 view_model_->set_ideal_bounds(model_index, old_ideal_bounds); |
| 1709 new_view->SetBoundsRect(old_view->bounds()); | 1709 new_view->SetBoundsRect(old_view->bounds()); |
| 1710 if (overflow_button_ && overflow_button_->visible()) | 1710 if (overflow_button_ && overflow_button_->visible()) |
| 1711 AnimateToIdealBounds(); | 1711 AnimateToIdealBounds(); |
| 1712 else |
| 1713 bounds_animator_->AnimateViewTo(new_view, old_ideal_bounds); |
| 1712 return; | 1714 return; |
| 1713 } | 1715 } |
| 1714 | 1716 |
| 1715 views::View* view = view_model_->view_at(model_index); | 1717 views::View* view = view_model_->view_at(model_index); |
| 1716 switch (item.type) { | 1718 switch (item.type) { |
| 1717 case TYPE_BROWSER_SHORTCUT: | 1719 case TYPE_BROWSER_SHORTCUT: |
| 1718 // Fallthrough for the new Shelf since it needs to show the activation | 1720 // Fallthrough for the new Shelf since it needs to show the activation |
| 1719 // change as well. | 1721 // change as well. |
| 1720 case TYPE_APP_SHORTCUT: | 1722 case TYPE_APP_SHORTCUT: |
| 1721 case TYPE_WINDOWED_APP: | 1723 case TYPE_WINDOWED_APP: |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 | 1914 |
| 1913 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1915 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1914 const gfx::Rect bounds = GetBoundsInScreen(); | 1916 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1915 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1917 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1916 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1918 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1917 bounds.x() - coordinate.x()); | 1919 bounds.x() - coordinate.x()); |
| 1918 return distance > 0 ? distance : 0; | 1920 return distance > 0 ? distance : 0; |
| 1919 } | 1921 } |
| 1920 | 1922 |
| 1921 } // namespace ash | 1923 } // namespace ash |
| OLD | NEW |