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 (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) |
msw
2011/09/27 03:51:42
event.message, etc.
oshima
2011/09/27 16:39:39
Done.
| |
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 void DraggedTabController::DidProcessEvent(const base::NativeEvent& event) { | |
sadrul
2011/09/27 04:13:23
+blank line
oshima
2011/09/27 16:39:39
Done.
| |
527 NOTIMPLEMENTED(); | |
523 } | 528 } |
524 #elif defined(TOOLKIT_USES_GTK) | 529 #elif defined(TOOLKIT_USES_GTK) |
525 void DraggedTabController::WillProcessEvent(GdkEvent* event) { | 530 void DraggedTabController::WillProcessEvent(GdkEvent* event) { |
526 } | 531 } |
527 | 532 |
528 void DraggedTabController::DidProcessEvent(GdkEvent* event) { | 533 void DraggedTabController::DidProcessEvent(GdkEvent* event) { |
529 if (event->type == GDK_KEY_PRESS && | 534 if (event->type == GDK_KEY_PRESS && |
530 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { | 535 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { |
531 EndDrag(true); | 536 EndDrag(true); |
532 } | 537 } |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1438 | 1443 |
1439 bool DraggedTabController::AreTabsConsecutive() { | 1444 bool DraggedTabController::AreTabsConsecutive() { |
1440 for (size_t i = 1; i < drag_data_.size(); ++i) { | 1445 for (size_t i = 1; i < drag_data_.size(); ++i) { |
1441 if (drag_data_[i - 1].source_model_index + 1 != | 1446 if (drag_data_[i - 1].source_model_index + 1 != |
1442 drag_data_[i].source_model_index) { | 1447 drag_data_[i].source_model_index) { |
1443 return false; | 1448 return false; |
1444 } | 1449 } |
1445 } | 1450 } |
1446 return true; | 1451 return true; |
1447 } | 1452 } |
OLD | NEW |