| 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/contents_view.h" | 5 #include "ui/app_list/views/contents_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/app_list/app_list_constants.h" | 10 #include "ui/app_list/app_list_constants.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 } | 297 } |
| 298 | 298 |
| 299 void ContentsView::OnScrollEvent(ui::ScrollEvent* event) { | 299 void ContentsView::OnScrollEvent(ui::ScrollEvent* event) { |
| 300 if (show_state_ != SHOW_APPS || | 300 if (show_state_ != SHOW_APPS || |
| 301 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 301 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 302 return; | 302 return; |
| 303 } | 303 } |
| 304 | 304 |
| 305 float offset; | 305 float offset; |
| 306 if (abs(event->x_offset()) > abs(event->y_offset())) | 306 if (std::abs(event->x_offset()) > std::abs(event->y_offset())) |
| 307 offset = event->x_offset(); | 307 offset = event->x_offset(); |
| 308 else | 308 else |
| 309 offset = event->y_offset(); | 309 offset = event->y_offset(); |
| 310 | 310 |
| 311 if (abs(offset) > kMinScrollToSwitchPage) { | 311 if (std::abs(offset) > kMinScrollToSwitchPage) { |
| 312 if (!pagination_model_->has_transition()) { | 312 if (!pagination_model_->has_transition()) { |
| 313 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, | 313 pagination_model_->SelectPageRelative(offset > 0 ? -1 : 1, |
| 314 true); | 314 true); |
| 315 } | 315 } |
| 316 event->SetHandled(); | 316 event->SetHandled(); |
| 317 event->StopPropagation(); | 317 event->StopPropagation(); |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 | 320 |
| 321 } // namespace app_list | 321 } // namespace app_list |
| OLD | NEW |