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 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1584 void ShelfView::ShelfItemMoved(int start_index, int target_index) { | 1584 void ShelfView::ShelfItemMoved(int start_index, int target_index) { |
1585 view_model_->Move(start_index, target_index); | 1585 view_model_->Move(start_index, target_index); |
1586 // When cancelling a drag due to a shelf item being added, the currently | 1586 // When cancelling a drag due to a shelf item being added, the currently |
1587 // dragged item is moved back to its initial position. AnimateToIdealBounds | 1587 // dragged item is moved back to its initial position. AnimateToIdealBounds |
1588 // will be called again when the new item is added to the |view_model_| but | 1588 // will be called again when the new item is added to the |view_model_| but |
1589 // at this time the |view_model_| is inconsistent with the |model_|. | 1589 // at this time the |view_model_| is inconsistent with the |model_|. |
1590 if (!cancelling_drag_model_changed_) | 1590 if (!cancelling_drag_model_changed_) |
1591 AnimateToIdealBounds(); | 1591 AnimateToIdealBounds(); |
1592 } | 1592 } |
1593 | 1593 |
1594 void ShelfView::OnSetShelfItemDelegate(ShelfID, ShelfItemDelegate*) {} | |
1595 | |
1596 void ShelfView::AfterItemSelected( | 1594 void ShelfView::AfterItemSelected( |
1597 const ShelfItem& item, | 1595 const ShelfItem& item, |
1598 views::Button* sender, | 1596 views::Button* sender, |
1599 std::unique_ptr<ui::Event> event, | 1597 std::unique_ptr<ui::Event> event, |
1600 views::InkDrop* ink_drop, | 1598 views::InkDrop* ink_drop, |
1601 ShelfAction action, | 1599 ShelfAction action, |
1602 base::Optional<std::vector<mojom::MenuItemPtr>> menu_items) { | 1600 base::Optional<std::vector<mojom::MenuItemPtr>> menu_items) { |
1603 shelf_button_pressed_metric_tracker_.ButtonPressed(*event, sender, action); | 1601 shelf_button_pressed_metric_tracker_.ButtonPressed(*event, sender, action); |
1604 | 1602 |
1605 // The app list handles its own ink drop effect state changes. | 1603 // The app list handles its own ink drop effect state changes. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1764 | 1762 |
1765 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1763 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1766 const gfx::Rect bounds = GetBoundsInScreen(); | 1764 const gfx::Rect bounds = GetBoundsInScreen(); |
1767 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1765 int distance = wm_shelf_->SelectValueForShelfAlignment( |
1768 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1766 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1769 bounds.x() - coordinate.x()); | 1767 bounds.x() - coordinate.x()); |
1770 return distance > 0 ? distance : 0; | 1768 return distance > 0 ? distance : 0; |
1771 } | 1769 } |
1772 | 1770 |
1773 } // namespace ash | 1771 } // namespace ash |
OLD | NEW |