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().OffsetFromOrigin(); |
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 void AppsGridView::TransitionChanged() { | 698 void AppsGridView::TransitionChanged() { |
699 // Update layout for valid page transition only since over-scroll no longer | 699 // Update layout for valid page transition only since over-scroll no longer |
700 // animates app icons. | 700 // animates app icons. |
701 const PaginationModel::Transition& transition = | 701 const PaginationModel::Transition& transition = |
702 pagination_model_->transition(); | 702 pagination_model_->transition(); |
703 if (pagination_model_->is_valid_page(transition.target_page)) | 703 if (pagination_model_->is_valid_page(transition.target_page)) |
704 Layout(); | 704 Layout(); |
705 } | 705 } |
706 | 706 |
707 } // namespace app_list | 707 } // namespace app_list |
OLD | NEW |