| 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/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 // Removing and re-inserting a view in our view model will strip the ideal | 1612 // Removing and re-inserting a view in our view model will strip the ideal |
| 1613 // bounds from the item. To avoid recalculation of everything the bounds | 1613 // bounds from the item. To avoid recalculation of everything the bounds |
| 1614 // get remembered and restored after the insertion to the previous value. | 1614 // get remembered and restored after the insertion to the previous value. |
| 1615 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index); | 1615 gfx::Rect old_ideal_bounds = view_model_->ideal_bounds(model_index); |
| 1616 view_model_->Remove(model_index); | 1616 view_model_->Remove(model_index); |
| 1617 views::View* new_view = CreateViewForItem(item); | 1617 views::View* new_view = CreateViewForItem(item); |
| 1618 AddChildView(new_view); | 1618 AddChildView(new_view); |
| 1619 view_model_->Add(new_view, model_index); | 1619 view_model_->Add(new_view, model_index); |
| 1620 view_model_->set_ideal_bounds(model_index, old_ideal_bounds); | 1620 view_model_->set_ideal_bounds(model_index, old_ideal_bounds); |
| 1621 new_view->SetBoundsRect(old_view->bounds()); | 1621 new_view->SetBoundsRect(old_view->bounds()); |
| 1622 if (overflow_button_ && overflow_button_->visible()) |
| 1623 AnimateToIdealBounds(); |
| 1622 return; | 1624 return; |
| 1623 } | 1625 } |
| 1624 | 1626 |
| 1625 views::View* view = view_model_->view_at(model_index); | 1627 views::View* view = view_model_->view_at(model_index); |
| 1626 switch (item.type) { | 1628 switch (item.type) { |
| 1627 case TYPE_BROWSER_SHORTCUT: | 1629 case TYPE_BROWSER_SHORTCUT: |
| 1628 // Fallthrough for the new Shelf since it needs to show the activation | 1630 // Fallthrough for the new Shelf since it needs to show the activation |
| 1629 // change as well. | 1631 // change as well. |
| 1630 case TYPE_APP_SHORTCUT: | 1632 case TYPE_APP_SHORTCUT: |
| 1631 case TYPE_WINDOWED_APP: | 1633 case TYPE_WINDOWED_APP: |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 | 1883 |
| 1882 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1884 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1883 const gfx::Rect bounds = GetBoundsInScreen(); | 1885 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1884 int distance = shelf_->SelectValueForShelfAlignment( | 1886 int distance = shelf_->SelectValueForShelfAlignment( |
| 1885 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1887 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1886 bounds.x() - coordinate.x()); | 1888 bounds.x() - coordinate.x()); |
| 1887 return distance > 0 ? distance : 0; | 1889 return distance > 0 ? distance : 0; |
| 1888 } | 1890 } |
| 1889 | 1891 |
| 1890 } // namespace ash | 1892 } // namespace ash |
| OLD | NEW |