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 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 ((event.type() == ui::ET_MOUSE_PRESSED && | 1137 ((event.type() == ui::ET_MOUSE_PRESSED && |
1138 (((event.flags() & ui::EF_FROM_TOUCH) && | 1138 (((event.flags() & ui::EF_FROM_TOUCH) && |
1139 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || | 1139 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || |
1140 (!(event.flags() & ui::EF_FROM_TOUCH) && | 1140 (!(event.flags() & ui::EF_FROM_TOUCH) && |
1141 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || | 1141 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || |
1142 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { | 1142 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { |
1143 move_behavior = TabDragController::MOVE_VISIBILE_TABS; | 1143 move_behavior = TabDragController::MOVE_VISIBILE_TABS; |
1144 } | 1144 } |
1145 | 1145 |
1146 views::Widget* widget = GetWidget(); | 1146 views::Widget* widget = GetWidget(); |
1147 | |
1148 // Don't allow detaching from maximized or fullscreen windows (in ash) when | |
1149 // all the tabs are selected and there is only one display. Since the window | |
1150 // is maximized or fullscreen, we know there are no other tabbed browsers the | |
1151 // user can drag to. | |
1152 const chrome::HostDesktopType host_desktop_type = | |
1153 chrome::GetHostDesktopTypeForNativeView(widget->GetNativeView()); | |
1154 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH && | |
1155 (widget->IsMaximized() || widget->IsFullscreen()) && | |
1156 static_cast<int>(tabs.size()) == tab_count() && | |
1157 gfx::Screen::GetScreenFor(widget->GetNativeView())->GetNumDisplays() == 1) | |
1158 detach_behavior = TabDragController::NOT_DETACHABLE; | |
1159 | |
1160 #if defined(OS_WIN) | 1147 #if defined(OS_WIN) |
1161 // It doesn't make sense to drag tabs out on Win8's single window Metro mode. | 1148 // It doesn't make sense to drag tabs out on Win8's single window Metro mode. |
1162 if (win8::IsSingleWindowMetroMode()) | 1149 if (win8::IsSingleWindowMetroMode()) |
1163 detach_behavior = TabDragController::NOT_DETACHABLE; | 1150 detach_behavior = TabDragController::NOT_DETACHABLE; |
1164 #endif | 1151 #endif |
1165 // Gestures don't automatically do a capture. We don't allow multiple drags at | 1152 // Gestures don't automatically do a capture. We don't allow multiple drags at |
1166 // the same time, so we explicitly capture. | 1153 // the same time, so we explicitly capture. |
1167 if (event.type() == ui::ET_GESTURE_BEGIN) | 1154 if (event.type() == ui::ET_GESTURE_BEGIN) |
1168 widget->SetCapture(this); | 1155 widget->SetCapture(this); |
1169 drag_controller_.reset(new TabDragController); | 1156 drag_controller_.reset(new TabDragController); |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 #if defined(USE_AURA) | 2743 #if defined(USE_AURA) |
2757 return chrome::GetHostDesktopTypeForNativeView( | 2744 return chrome::GetHostDesktopTypeForNativeView( |
2758 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; | 2745 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; |
2759 #else | 2746 #else |
2760 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2747 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
2761 return false; | 2748 return false; |
2762 #endif | 2749 #endif |
2763 | 2750 |
2764 return true; | 2751 return true; |
2765 } | 2752 } |
OLD | NEW |