| 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/contents_view.h" | 5 #include "ui/app_list/contents_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/app_list_view.h" | 9 #include "ui/app_list/app_list_view.h" |
| 10 #include "ui/app_list/apps_grid_view.h" | 10 #include "ui/app_list/apps_grid_view.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 case ui::ET_GESTURE_SCROLL_UPDATE: | 197 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 198 // event.details.scroll_x() > 0 means moving contents to right. That is, | 198 // event.details.scroll_x() > 0 means moving contents to right. That is, |
| 199 // transitioning to previous page. | 199 // transitioning to previous page. |
| 200 pagination_model_->UpdateScroll( | 200 pagination_model_->UpdateScroll( |
| 201 event.details().scroll_x() / GetContentsBounds().width()); | 201 event.details().scroll_x() / GetContentsBounds().width()); |
| 202 return ui::GESTURE_STATUS_CONSUMED; | 202 return ui::GESTURE_STATUS_CONSUMED; |
| 203 case ui::ET_GESTURE_SCROLL_END: | 203 case ui::ET_GESTURE_SCROLL_END: |
| 204 pagination_model_->EndScroll(); | 204 pagination_model_->EndScroll(); |
| 205 return ui::GESTURE_STATUS_CONSUMED; | 205 return ui::GESTURE_STATUS_CONSUMED; |
| 206 case ui::ET_SCROLL_FLING_START: { | 206 case ui::ET_SCROLL_FLING_START: { |
| 207 pagination_model_->EndScroll(); |
| 207 if (fabs(event.details().velocity_x()) > kMinHorizVelocityToSwitchPage) { | 208 if (fabs(event.details().velocity_x()) > kMinHorizVelocityToSwitchPage) { |
| 209 pagination_model_->ResetTransitionAnimation(); |
| 208 pagination_model_->SelectPageRelative( | 210 pagination_model_->SelectPageRelative( |
| 209 event.details().velocity_x() < 0 ? 1 : -1, | 211 event.details().velocity_x() < 0 ? 1 : -1, |
| 210 true); | 212 true); |
| 211 return ui::GESTURE_STATUS_CONSUMED; | |
| 212 } | 213 } |
| 213 break; | 214 return ui::GESTURE_STATUS_CONSUMED; |
| 214 } | 215 } |
| 215 default: | 216 default: |
| 216 break; | 217 break; |
| 217 } | 218 } |
| 218 | 219 |
| 219 return ui::GESTURE_STATUS_UNKNOWN; | 220 return ui::GESTURE_STATUS_UNKNOWN; |
| 220 } | 221 } |
| 221 | 222 |
| 222 bool ContentsView::OnKeyPressed(const views::KeyEvent& event) { | 223 bool ContentsView::OnKeyPressed(const views::KeyEvent& event) { |
| 223 switch (show_state_) { | 224 switch (show_state_) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 253 pagination_model_->SelectPageRelative(event.x_offset() > 0 ? 1 : -1, | 254 pagination_model_->SelectPageRelative(event.x_offset() > 0 ? 1 : -1, |
| 254 true); | 255 true); |
| 255 } | 256 } |
| 256 return true; | 257 return true; |
| 257 } | 258 } |
| 258 | 259 |
| 259 return false; | 260 return false; |
| 260 } | 261 } |
| 261 | 262 |
| 262 } // namespace app_list | 263 } // namespace app_list |
| OLD | NEW |