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_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 model_->items()[start_drag_index_].id); | 1066 model_->items()[start_drag_index_].id); |
1067 if (!item_delegate->IsDraggable()) { | 1067 if (!item_delegate->IsDraggable()) { |
1068 CancelDrag(-1); | 1068 CancelDrag(-1); |
1069 return; | 1069 return; |
1070 } | 1070 } |
1071 | 1071 |
1072 // Move the view to the front so that it appears on top of other views. | 1072 // Move the view to the front so that it appears on top of other views. |
1073 ReorderChildView(drag_view_, -1); | 1073 ReorderChildView(drag_view_, -1); |
1074 bounds_animator_->StopAnimatingView(drag_view_); | 1074 bounds_animator_->StopAnimatingView(drag_view_); |
1075 | 1075 |
1076 drag_view_->OnDragStarted(); | 1076 drag_view_->OnDragStarted(&event); |
1077 } | 1077 } |
1078 | 1078 |
1079 void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { | 1079 void ShelfView::ContinueDrag(const ui::LocatedEvent& event) { |
1080 // Due to a syncing operation the application might have been removed. | 1080 // Due to a syncing operation the application might have been removed. |
1081 // Bail if it is gone. | 1081 // Bail if it is gone. |
1082 int current_index = view_model_->GetIndexOfView(drag_view_); | 1082 int current_index = view_model_->GetIndexOfView(drag_view_); |
1083 DCHECK_NE(-1, current_index); | 1083 DCHECK_NE(-1, current_index); |
1084 | 1084 |
1085 ShelfItemDelegate* item_delegate = | 1085 ShelfItemDelegate* item_delegate = |
1086 item_manager_->GetShelfItemDelegate(model_->items()[current_index].id); | 1086 item_manager_->GetShelfItemDelegate(model_->items()[current_index].id); |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1919 | 1919 |
1920 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1920 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
1921 const gfx::Rect bounds = GetBoundsInScreen(); | 1921 const gfx::Rect bounds = GetBoundsInScreen(); |
1922 int distance = shelf_->SelectValueForShelfAlignment( | 1922 int distance = shelf_->SelectValueForShelfAlignment( |
1923 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1923 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
1924 bounds.x() - coordinate.x()); | 1924 bounds.x() - coordinate.x()); |
1925 return distance > 0 ? distance : 0; | 1925 return distance > 0 ? distance : 0; |
1926 } | 1926 } |
1927 | 1927 |
1928 } // namespace ash | 1928 } // namespace ash |
OLD | NEW |