| 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 "ui/app_list/apps_grid_view.h" | 5 #include "ui/app_list/apps_grid_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/app_list_item_model.h" | 9 #include "ui/app_list/app_list_item_model.h" |
| 10 #include "ui/app_list/app_list_item_view.h" | 10 #include "ui/app_list/app_list_item_view.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 pagination_model_->SelectPage(index.page, false); | 162 pagination_model_->SelectPage(index.page, false); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void AppsGridView::InitiateDrag(views::View* view, | 165 void AppsGridView::InitiateDrag(views::View* view, |
| 166 Pointer pointer, | 166 Pointer pointer, |
| 167 const ui::LocatedEvent& event) { | 167 const ui::LocatedEvent& event) { |
| 168 if (drag_view_) | 168 if (drag_view_) |
| 169 return; | 169 return; |
| 170 | 170 |
| 171 drag_view_ = view; | 171 drag_view_ = view; |
| 172 drag_offset_ = event.location(); | 172 drag_offset_ = event.location().DistanceFromOrigin(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void AppsGridView::UpdateDrag(views::View* view, | 175 void AppsGridView::UpdateDrag(views::View* view, |
| 176 Pointer pointer, | 176 Pointer pointer, |
| 177 const ui::LocatedEvent& event) { | 177 const ui::LocatedEvent& event) { |
| 178 if (!dragging() && drag_view_ && | 178 if (!dragging() && drag_view_ && |
| 179 ExceededDragThreshold(event.x() - drag_offset_.x(), | 179 ExceededDragThreshold(event.x() - drag_offset_.x(), |
| 180 event.y() - drag_offset_.y())) { | 180 event.y() - drag_offset_.y())) { |
| 181 drag_pointer_ = pointer; | 181 drag_pointer_ = pointer; |
| 182 // Move the view to the front so that it appears on top of other views. | 182 // Move the view to the front so that it appears on top of other views. |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 void AppsGridView::TransitionChanged() { | 696 void AppsGridView::TransitionChanged() { |
| 697 // Update layout for valid page transition only since over-scroll no longer | 697 // Update layout for valid page transition only since over-scroll no longer |
| 698 // animates app icons. | 698 // animates app icons. |
| 699 const PaginationModel::Transition& transition = | 699 const PaginationModel::Transition& transition = |
| 700 pagination_model_->transition(); | 700 pagination_model_->transition(); |
| 701 if (pagination_model_->is_valid_page(transition.target_page)) | 701 if (pagination_model_->is_valid_page(transition.target_page)) |
| 702 Layout(); | 702 Layout(); |
| 703 } | 703 } |
| 704 | 704 |
| 705 } // namespace app_list | 705 } // namespace app_list |
| OLD | NEW |