| 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 "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 if (touch_layout_.get() && | 1141 if (touch_layout_.get() && |
| 1142 ((event.type() == ui::ET_MOUSE_PRESSED && | 1142 ((event.type() == ui::ET_MOUSE_PRESSED && |
| 1143 (((event.flags() & ui::EF_FROM_TOUCH) && | 1143 (((event.flags() & ui::EF_FROM_TOUCH) && |
| 1144 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || | 1144 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || |
| 1145 (!(event.flags() & ui::EF_FROM_TOUCH) && | 1145 (!(event.flags() & ui::EF_FROM_TOUCH) && |
| 1146 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || | 1146 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || |
| 1147 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { | 1147 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { |
| 1148 move_behavior = TabDragController::MOVE_VISIBILE_TABS; | 1148 move_behavior = TabDragController::MOVE_VISIBILE_TABS; |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 views::Widget* widget = GetWidget(); | |
| 1152 #if defined(OS_WIN) | 1151 #if defined(OS_WIN) |
| 1153 // It doesn't make sense to drag tabs out on Win8's single window Metro mode. | 1152 // It doesn't make sense to drag tabs out on Win8's single window Metro mode. |
| 1154 if (win8::IsSingleWindowMetroMode()) | 1153 if (win8::IsSingleWindowMetroMode()) |
| 1155 detach_behavior = TabDragController::NOT_DETACHABLE; | 1154 detach_behavior = TabDragController::NOT_DETACHABLE; |
| 1156 #endif | 1155 #endif |
| 1157 // Gestures don't automatically do a capture. We don't allow multiple drags at | |
| 1158 // the same time, so we explicitly capture. | |
| 1159 if (event.type() == ui::ET_GESTURE_BEGIN) | |
| 1160 widget->SetCapture(this); | |
| 1161 drag_controller_.reset(new TabDragController); | 1156 drag_controller_.reset(new TabDragController); |
| 1162 drag_controller_->Init( | 1157 drag_controller_->Init( |
| 1163 this, tab, tabs, gfx::Point(x, y), event.x(), selection_model, | 1158 this, tab, tabs, gfx::Point(x, y), event.x(), selection_model, |
| 1164 detach_behavior, move_behavior, EventSourceFromEvent(event)); | 1159 detach_behavior, move_behavior, EventSourceFromEvent(event)); |
| 1165 } | 1160 } |
| 1166 | 1161 |
| 1167 void TabStrip::ContinueDrag(views::View* view, const ui::LocatedEvent& event) { | 1162 void TabStrip::ContinueDrag(views::View* view, const ui::LocatedEvent& event) { |
| 1168 if (drag_controller_.get() && | 1163 if (drag_controller_.get() && |
| 1169 drag_controller_->event_source() == EventSourceFromEvent(event)) { | 1164 drag_controller_->event_source() == EventSourceFromEvent(event)) { |
| 1170 gfx::Point screen_location(event.location()); | 1165 gfx::Point screen_location(event.location()); |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2775 #if defined(USE_AURA) | 2770 #if defined(USE_AURA) |
| 2776 return chrome::GetHostDesktopTypeForNativeView( | 2771 return chrome::GetHostDesktopTypeForNativeView( |
| 2777 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; | 2772 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; |
| 2778 #else | 2773 #else |
| 2779 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2774 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
| 2780 return false; | 2775 return false; |
| 2781 #endif | 2776 #endif |
| 2782 | 2777 |
| 2783 return true; | 2778 return true; |
| 2784 } | 2779 } |
| OLD | NEW |