| 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/app_list_item_view.h" | 5 #include "ui/app_list/app_list_item_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "ui/app_list/app_list_item_model.h" | 10 #include "ui/app_list/app_list_item_model.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // Shows dragging UI when it's confirmed without waiting for the timer. | 306 // Shows dragging UI when it's confirmed without waiting for the timer. |
| 307 if (ui_state_ != UI_STATE_DRAGGING && | 307 if (ui_state_ != UI_STATE_DRAGGING && |
| 308 apps_grid_view_->dragging() && | 308 apps_grid_view_->dragging() && |
| 309 apps_grid_view_->IsDraggedView(this)) { | 309 apps_grid_view_->IsDraggedView(this)) { |
| 310 mouse_drag_timer_.Stop(); | 310 mouse_drag_timer_.Stop(); |
| 311 SetUIState(UI_STATE_DRAGGING); | 311 SetUIState(UI_STATE_DRAGGING); |
| 312 } | 312 } |
| 313 return true; | 313 return true; |
| 314 } | 314 } |
| 315 | 315 |
| 316 ui::EventResult AppListItemView::OnGestureEvent(ui::GestureEvent* event) { | 316 void AppListItemView::OnGestureEvent(ui::GestureEvent* event) { |
| 317 switch (event->type()) { | 317 switch (event->type()) { |
| 318 case ui::ET_GESTURE_SCROLL_BEGIN: | 318 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 319 if (touch_dragging_) { | 319 if (touch_dragging_) { |
| 320 apps_grid_view_->InitiateDrag(this, AppsGridView::TOUCH, *event); | 320 apps_grid_view_->InitiateDrag(this, AppsGridView::TOUCH, *event); |
| 321 return ui::ER_CONSUMED; | 321 event->SetHandled(); |
| 322 } | 322 } |
| 323 break; | 323 break; |
| 324 case ui::ET_GESTURE_SCROLL_UPDATE: | 324 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 325 if (touch_dragging_) { | 325 if (touch_dragging_) { |
| 326 apps_grid_view_->UpdateDrag(this, AppsGridView::TOUCH, *event); | 326 apps_grid_view_->UpdateDrag(this, AppsGridView::TOUCH, *event); |
| 327 return ui::ER_CONSUMED; | 327 event->SetHandled(); |
| 328 } | 328 } |
| 329 break; | 329 break; |
| 330 case ui::ET_GESTURE_SCROLL_END: | 330 case ui::ET_GESTURE_SCROLL_END: |
| 331 case ui::ET_SCROLL_FLING_START: | 331 case ui::ET_SCROLL_FLING_START: |
| 332 if (touch_dragging_) { | 332 if (touch_dragging_) { |
| 333 SetTouchDragging(false); | 333 SetTouchDragging(false); |
| 334 apps_grid_view_->EndDrag(false); | 334 apps_grid_view_->EndDrag(false); |
| 335 return ui::ER_CONSUMED; | 335 event->SetHandled(); |
| 336 } | 336 } |
| 337 break; | 337 break; |
| 338 case ui::ET_GESTURE_LONG_PRESS: | 338 case ui::ET_GESTURE_LONG_PRESS: |
| 339 if (!apps_grid_view_->has_dragged_view()) | 339 if (!apps_grid_view_->has_dragged_view()) |
| 340 SetTouchDragging(true); | 340 SetTouchDragging(true); |
| 341 return ui::ER_CONSUMED; | 341 event->SetHandled(); |
| 342 break; |
| 342 case ui::ET_GESTURE_END: | 343 case ui::ET_GESTURE_END: |
| 343 if (touch_dragging_) { | 344 if (touch_dragging_) { |
| 344 SetTouchDragging(false); | 345 SetTouchDragging(false); |
| 345 | 346 |
| 346 gfx::Point location(event->location()); | 347 gfx::Point location(event->location()); |
| 347 ConvertPointToScreen(this, &location); | 348 ConvertPointToScreen(this, &location); |
| 348 ShowContextMenu(location, true); | 349 ShowContextMenu(location, true); |
| 349 } | 350 } |
| 350 break; | 351 break; |
| 351 default: | 352 default: |
| 352 break; | 353 break; |
| 353 } | 354 } |
| 354 return CustomButton::OnGestureEvent(event); | 355 if (!event->handled()) |
| 356 CustomButton::OnGestureEvent(event); |
| 355 } | 357 } |
| 356 | 358 |
| 357 } // namespace app_list | 359 } // namespace app_list |
| OLD | NEW |