| 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 if (new_y_position < 0) { | 509 if (new_y_position < 0) { |
| 510 new_widget_bounds.set_y(0); | 510 new_widget_bounds.set_y(0); |
| 511 initial_drag_point_ = location; | 511 initial_drag_point_ = location; |
| 512 } else { | 512 } else { |
| 513 new_widget_bounds.set_y(new_y_position); | 513 new_widget_bounds.set_y(new_y_position); |
| 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 // When the SearchBoxView closes the app list, ignore the final event. |
| 520 if (app_list_state_ == CLOSED) |
| 521 return; |
| 519 // Change the app list state based on where the drag ended. If fling velocity | 522 // 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 | 523 // was over the threshold, snap to the next state in the direction of the |
| 521 // fling. | 524 // fling. |
| 522 int const new_y_position = location.y() - initial_drag_point_.y() + | 525 int const new_y_position = location.y() - initial_drag_point_.y() + |
| 523 fullscreen_widget_->GetWindowBoundsInScreen().y(); | 526 fullscreen_widget_->GetWindowBoundsInScreen().y(); |
| 524 if (std::abs(last_fling_velocity_) > kAppListDragVelocityThreshold) { | 527 if (std::abs(last_fling_velocity_) > kAppListDragVelocityThreshold) { |
| 525 // If the user releases drag with velocity over the threshold, snap to | 528 // If the user releases drag with velocity over the threshold, snap to |
| 526 // the next state, ignoring the drag release position. | 529 // the next state, ignoring the drag release position. |
| 527 | 530 |
| 528 if (last_fling_velocity_ > 0) { | 531 if (last_fling_velocity_ > 0) { |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 .work_area() | 961 .work_area() |
| 959 .size(); | 962 .size(); |
| 960 size.Enlarge(0, kShelfSize); | 963 size.Enlarge(0, kShelfSize); |
| 961 fullscreen_widget_->SetSize(size); | 964 fullscreen_widget_->SetSize(size); |
| 962 | 965 |
| 963 // Update the |fullscreen_widget_| bounds to accomodate the new work area. | 966 // Update the |fullscreen_widget_| bounds to accomodate the new work area. |
| 964 SetState(app_list_state_); | 967 SetState(app_list_state_); |
| 965 } | 968 } |
| 966 | 969 |
| 967 } // namespace app_list | 970 } // namespace app_list |
| OLD | NEW |