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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 } | 499 } |
500 // If we get here it means we got notification for a tab we don't know about. | 500 // If we get here it means we got notification for a tab we don't know about. |
501 NOTREACHED(); | 501 NOTREACHED(); |
502 } | 502 } |
503 | 503 |
504 /////////////////////////////////////////////////////////////////////////////// | 504 /////////////////////////////////////////////////////////////////////////////// |
505 // DraggedTabController, MessageLoop::Observer implementation: | 505 // DraggedTabController, MessageLoop::Observer implementation: |
506 | 506 |
507 #if defined(OS_WIN) | 507 #if defined(OS_WIN) |
508 void DraggedTabController::WillProcessMessage(const MSG& msg) { | 508 base::EventStatus DraggedTabController::WillProcessEvent( |
| 509 const base::NativeEvent& event) { |
| 510 return base::EVENT_CONTINUE; |
509 } | 511 } |
510 | 512 |
511 void DraggedTabController::DidProcessMessage(const MSG& msg) { | 513 void DraggedTabController::DidProcessEvent(const base::NativeEvent& event) { |
512 // If the user presses ESC during a drag, we need to abort and revert things | 514 // If the user presses ESC during a drag, we need to abort and revert things |
513 // to the way they were. This is the most reliable way to do this since no | 515 // to the way they were. This is the most reliable way to do this since no |
514 // single view or window reliably receives events throughout all the various | 516 // single view or window reliably receives events throughout all the various |
515 // kinds of tab dragging. | 517 // kinds of tab dragging. |
516 if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) | 518 if (event.message == WM_KEYDOWN && event.wParam == VK_ESCAPE) |
517 EndDrag(true); | 519 EndDrag(true); |
518 } | 520 } |
519 #elif defined(TOUCH_UI) | 521 #elif defined(TOUCH_UI) || defined(USE_AURA) |
520 base::MessagePumpObserver::EventStatus | 522 base::EventStatus DraggedTabController::WillProcessEvent( |
521 DraggedTabController::WillProcessXEvent(XEvent* xevent) { | 523 const base::NativeEvent& event) { |
522 return EVENT_CONTINUE; | 524 return base::EVENT_CONTINUE; |
| 525 } |
| 526 |
| 527 void DraggedTabController::DidProcessEvent(const base::NativeEvent& event) { |
| 528 NOTIMPLEMENTED(); |
523 } | 529 } |
524 #elif defined(TOOLKIT_USES_GTK) | 530 #elif defined(TOOLKIT_USES_GTK) |
525 void DraggedTabController::WillProcessEvent(GdkEvent* event) { | 531 void DraggedTabController::WillProcessEvent(GdkEvent* event) { |
526 } | 532 } |
527 | 533 |
528 void DraggedTabController::DidProcessEvent(GdkEvent* event) { | 534 void DraggedTabController::DidProcessEvent(GdkEvent* event) { |
529 if (event->type == GDK_KEY_PRESS && | 535 if (event->type == GDK_KEY_PRESS && |
530 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { | 536 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { |
531 EndDrag(true); | 537 EndDrag(true); |
532 } | 538 } |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 | 1444 |
1439 bool DraggedTabController::AreTabsConsecutive() { | 1445 bool DraggedTabController::AreTabsConsecutive() { |
1440 for (size_t i = 1; i < drag_data_.size(); ++i) { | 1446 for (size_t i = 1; i < drag_data_.size(); ++i) { |
1441 if (drag_data_[i - 1].source_model_index + 1 != | 1447 if (drag_data_[i - 1].source_model_index + 1 != |
1442 drag_data_[i].source_model_index) { | 1448 drag_data_[i].source_model_index) { |
1443 return false; | 1449 return false; |
1444 } | 1450 } |
1445 } | 1451 } |
1446 return true; | 1452 return true; |
1447 } | 1453 } |
OLD | NEW |