| 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/views/app_list_view.h" | 5 #include "ui/app_list/views/app_list_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 514 } |
| 515 fullscreen_widget_->SetBounds(new_widget_bounds); | 515 fullscreen_widget_->SetBounds(new_widget_bounds); |
| 516 } | 516 } |
| 517 | 517 |
| 518 void AppListView::EndDrag(const gfx::Point& location) { | 518 void AppListView::EndDrag(const gfx::Point& location) { |
| 519 // Change the app list state based on where the drag ended. If fling velocity | 519 // Change the app list state based on where the drag ended. If fling velocity |
| 520 // was over the threshold, snap to the next state in the direction of the | 520 // was over the threshold, snap to the next state in the direction of the |
| 521 // fling. | 521 // fling. |
| 522 int const new_y_position = location.y() - initial_drag_point_.y() + | 522 int const new_y_position = location.y() - initial_drag_point_.y() + |
| 523 fullscreen_widget_->GetWindowBoundsInScreen().y(); | 523 fullscreen_widget_->GetWindowBoundsInScreen().y(); |
| 524 if (std::abs(last_fling_velocity_) > kAppListDragVelocityThreshold) { | 524 if (std::abs(last_fling_velocity_) >= kAppListDragVelocityThreshold) { |
| 525 // If the user releases drag with velocity over the threshold, snap to | 525 // If the user releases drag with velocity over the threshold, snap to |
| 526 // the next state, ignoring the drag release position. | 526 // the next state, ignoring the drag release position. |
| 527 | 527 |
| 528 if (last_fling_velocity_ > 0) { | 528 if (last_fling_velocity_ > 0) { |
| 529 switch (app_list_state_) { | 529 switch (app_list_state_) { |
| 530 case PEEKING: | 530 case PEEKING: |
| 531 case HALF: | 531 case HALF: |
| 532 case FULLSCREEN_SEARCH: | 532 case FULLSCREEN_SEARCH: |
| 533 SetState(CLOSED); | 533 SetState(CLOSED); |
| 534 break; | 534 break; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 default: | 717 default: |
| 718 break; | 718 break; |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 | 721 |
| 722 void AppListView::OnGestureEvent(ui::GestureEvent* event) { | 722 void AppListView::OnGestureEvent(ui::GestureEvent* event) { |
| 723 if (!is_fullscreen_app_list_enabled_) | 723 if (!is_fullscreen_app_list_enabled_) |
| 724 return; | 724 return; |
| 725 | 725 |
| 726 switch (event->type()) { | 726 switch (event->type()) { |
| 727 case ui::ET_SCROLL_FLING_START: |
| 727 case ui::ET_GESTURE_SCROLL_BEGIN: | 728 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 728 StartDrag(event->location()); | 729 StartDrag(event->location()); |
| 729 event->SetHandled(); | 730 event->SetHandled(); |
| 730 break; | 731 break; |
| 731 case ui::ET_GESTURE_SCROLL_UPDATE: | 732 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 732 last_fling_velocity_ = event->details().velocity_y(); | 733 last_fling_velocity_ = event->details().scroll_y(); |
| 733 UpdateDrag(event->location()); | 734 UpdateDrag(event->location()); |
| 734 event->SetHandled(); | 735 event->SetHandled(); |
| 735 break; | 736 break; |
| 736 case ui::ET_GESTURE_END: | 737 case ui::ET_GESTURE_END: |
| 737 EndDrag(event->location()); | 738 EndDrag(event->location()); |
| 738 event->SetHandled(); | 739 event->SetHandled(); |
| 739 break; | 740 break; |
| 740 default: | 741 default: |
| 741 break; | 742 break; |
| 742 } | 743 } |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 .work_area() | 959 .work_area() |
| 959 .size(); | 960 .size(); |
| 960 size.Enlarge(0, kShelfSize); | 961 size.Enlarge(0, kShelfSize); |
| 961 fullscreen_widget_->SetSize(size); | 962 fullscreen_widget_->SetSize(size); |
| 962 | 963 |
| 963 // Update the |fullscreen_widget_| bounds to accomodate the new work area. | 964 // Update the |fullscreen_widget_| bounds to accomodate the new work area. |
| 964 SetState(app_list_state_); | 965 SetState(app_list_state_); |
| 965 } | 966 } |
| 966 | 967 |
| 967 } // namespace app_list | 968 } // namespace app_list |
| OLD | NEW |