Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: chrome/browser/ui/views/tabs/dragged_tab_controller.cc

Issue 8021009: Consolidate message observer API for win and aura (and touch). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(const MSG& msg) {
509 return base::EVENT_CONTINUE;
509 } 510 }
510 511
511 void DraggedTabController::DidProcessMessage(const MSG& msg) { 512 void DraggedTabController::DidProcessEvent(const MSG& msg) {
512 // If the user presses ESC during a drag, we need to abort and revert things 513 // 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 514 // 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 515 // single view or window reliably receives events throughout all the various
515 // kinds of tab dragging. 516 // kinds of tab dragging.
516 if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE) 517 if (msg.message == WM_KEYDOWN && msg.wParam == VK_ESCAPE)
517 EndDrag(true); 518 EndDrag(true);
518 } 519 }
519 #elif defined(TOUCH_UI) 520 #elif defined(TOUCH_UI) || defined(USE_AURA)
520 base::MessagePumpObserver::EventStatus 521 base::EventStatus DraggedTabController::WillProcessEvent(
521 DraggedTabController::WillProcessXEvent(XEvent* xevent) { 522 const base::NativeEvent& xevent) {
522 return EVENT_CONTINUE; 523 return base::EVENT_CONTINUE;
524 }
525 void DraggedTabController::DidProcessEvent(const base::NativeEvent& xevent) {
526 NOTIMPLEMENTED();
523 } 527 }
524 #elif defined(TOOLKIT_USES_GTK) 528 #elif defined(TOOLKIT_USES_GTK)
525 void DraggedTabController::WillProcessEvent(GdkEvent* event) { 529 void DraggedTabController::WillProcessEvent(GdkEvent* event) {
526 } 530 }
527 531
528 void DraggedTabController::DidProcessEvent(GdkEvent* event) { 532 void DraggedTabController::DidProcessEvent(GdkEvent* event) {
529 if (event->type == GDK_KEY_PRESS && 533 if (event->type == GDK_KEY_PRESS &&
530 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) { 534 reinterpret_cast<GdkEventKey*>(event)->keyval == GDK_Escape) {
531 EndDrag(true); 535 EndDrag(true);
532 } 536 }
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 1439
1436 bool DraggedTabController::AreTabsConsecutive() { 1440 bool DraggedTabController::AreTabsConsecutive() {
1437 for (size_t i = 1; i < drag_data_.size(); ++i) { 1441 for (size_t i = 1; i < drag_data_.size(); ++i) {
1438 if (drag_data_[i - 1].source_model_index + 1 != 1442 if (drag_data_[i - 1].source_model_index + 1 !=
1439 drag_data_[i].source_model_index) { 1443 drag_data_[i].source_model_index) {
1440 return false; 1444 return false;
1441 } 1445 }
1442 } 1446 }
1443 return true; 1447 return true;
1444 } 1448 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698