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 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 void ShelfView::ShelfItemMoved(int start_index, int target_index) { | 1579 void ShelfView::ShelfItemMoved(int start_index, int target_index) { |
1580 view_model_->Move(start_index, target_index); | 1580 view_model_->Move(start_index, target_index); |
1581 // When cancelling a drag due to a shelf item being added, the currently | 1581 // When cancelling a drag due to a shelf item being added, the currently |
1582 // dragged item is moved back to its initial position. AnimateToIdealBounds | 1582 // dragged item is moved back to its initial position. AnimateToIdealBounds |
1583 // will be called again when the new item is added to the |view_model_| but | 1583 // will be called again when the new item is added to the |view_model_| but |
1584 // at this time the |view_model_| is inconsistent with the |model_|. | 1584 // at this time the |view_model_| is inconsistent with the |model_|. |
1585 if (!cancelling_drag_model_changed_) | 1585 if (!cancelling_drag_model_changed_) |
1586 AnimateToIdealBounds(); | 1586 AnimateToIdealBounds(); |
1587 } | 1587 } |
1588 | 1588 |
1589 void ShelfView::ShelfStatusChanged() { | |
1590 // Nothing to do here. | |
1591 } | |
1592 | |
1593 void ShelfView::PointerPressedOnButton(views::View* view, | 1589 void ShelfView::PointerPressedOnButton(views::View* view, |
1594 Pointer pointer, | 1590 Pointer pointer, |
1595 const ui::LocatedEvent& event) { | 1591 const ui::LocatedEvent& event) { |
1596 if (drag_view_) | 1592 if (drag_view_) |
1597 return; | 1593 return; |
1598 | 1594 |
1599 int index = view_model_->GetIndexOfView(view); | 1595 int index = view_model_->GetIndexOfView(view); |
1600 if (index == -1) | 1596 if (index == -1) |
1601 return; | 1597 return; |
1602 | 1598 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 | 1955 |
1960 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1956 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1961 const gfx::Rect bounds = GetBoundsInScreen(); | 1957 const gfx::Rect bounds = GetBoundsInScreen(); |
1962 int distance = shelf_->SelectValueForShelfAlignment( | 1958 int distance = shelf_->SelectValueForShelfAlignment( |
1963 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1959 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1964 bounds.x() - coordinate.x(), coordinate.y() - bounds.bottom()); | 1960 bounds.x() - coordinate.x(), coordinate.y() - bounds.bottom()); |
1965 return distance > 0 ? distance : 0; | 1961 return distance > 0 ? distance : 0; |
1966 } | 1962 } |
1967 | 1963 |
1968 } // namespace ash | 1964 } // namespace ash |
OLD | NEW |