| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/views/tabs/dragged_tab_controller.h" | 5 #include "chrome/browser/ui/views/tabs/dragged_tab_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 } | 524 } |
| 525 | 525 |
| 526 void DraggedTabController::DidProcessMessage(const MSG& msg) { | 526 void DraggedTabController::DidProcessMessage(const MSG& msg) { |
| 527 // If the user presses ESC during a drag, we need to abort and revert things | 527 // If the user presses ESC during a drag, we need to abort and revert things |
| 528 // to the way they were. This is the most reliable way to do this since no | 528 // to the way they were. This is the most reliable way to do this since no |
| 529 // single view or window reliably receives events throughout all the various | 529 // single view or window reliably receives events throughout all the various |
| 530 // kinds of tab dragging. | 530 // kinds of tab dragging. |
| 531 if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) | 531 if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) |
| 532 EndDrag(true); | 532 EndDrag(true); |
| 533 } | 533 } |
| 534 #elif defined(TOUCH_UI) |
| 535 base::MessagePumpObserver::EventStatus |
| 536 DraggedTabController::WillProcessXEvent(XEvent* xevent) { |
| 537 return EVENT_CONTINUE; |
| 538 } |
| 534 #elif defined(TOOLKIT_USES_GTK) | 539 #elif defined(TOOLKIT_USES_GTK) |
| 535 void DraggedTabController::WillProcessEvent(GdkEvent* event) { | 540 void DraggedTabController::WillProcessEvent(GdkEvent* event) { |
| 536 } | 541 } |
| 537 | 542 |
| 538 void DraggedTabController::DidProcessEvent(GdkEvent* event) { | 543 void DraggedTabController::DidProcessEvent(GdkEvent* event) { |
| 539 if (event->type == GDK_KEY_PRESS && | 544 if (event->type == GDK_KEY_PRESS && |
| 540 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { | 545 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { |
| 541 EndDrag(true); | 546 EndDrag(true); |
| 542 } | 547 } |
| 543 } | 548 } |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1440 | 1445 |
| 1441 bool DraggedTabController::AreTabsConsecutive() { | 1446 bool DraggedTabController::AreTabsConsecutive() { |
| 1442 for (size_t i = 1; i < drag_data_.size(); ++i) { | 1447 for (size_t i = 1; i < drag_data_.size(); ++i) { |
| 1443 if (drag_data_[i - 1].source_model_index + 1 != | 1448 if (drag_data_[i - 1].source_model_index + 1 != |
| 1444 drag_data_[i].source_model_index) { | 1449 drag_data_[i].source_model_index) { |
| 1445 return false; | 1450 return false; |
| 1446 } | 1451 } |
| 1447 } | 1452 } |
| 1448 return true; | 1453 return true; |
| 1449 } | 1454 } |
| OLD | NEW |