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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1017 (event.type() == ui::ET_GESTURE_BEGIN))) { | 1017 (event.type() == ui::ET_GESTURE_BEGIN))) { |
1018 move_behavior = TabDragController::MOVE_VISIBILE_TABS; | 1018 move_behavior = TabDragController::MOVE_VISIBILE_TABS; |
1019 } | 1019 } |
1020 #if defined(OS_WIN) | 1020 #if defined(OS_WIN) |
1021 // It doesn't make sense to drag tabs out on metro. | 1021 // It doesn't make sense to drag tabs out on metro. |
1022 if (base::win::IsMetroProcess()) | 1022 if (base::win::IsMetroProcess()) |
1023 detach_behavior = TabDragController::NOT_DETACHABLE; | 1023 detach_behavior = TabDragController::NOT_DETACHABLE; |
1024 #endif | 1024 #endif |
1025 // Gestures don't automatically do a capture. We don't allow multiple drags at | 1025 // Gestures don't automatically do a capture. We don't allow multiple drags at |
1026 // the same time, so we explicitly capture. | 1026 // the same time, so we explicitly capture. |
1027 if (event.type() == ui::ET_GESTURE_TAP_DOWN) | 1027 if (event.type() == ui::ET_GESTURE_BEGIN) |
sadrul
2012/08/03 21:38:07
Is it necessary to check that event.details().touc
| |
1028 GetWidget()->SetCapture(this); | 1028 GetWidget()->SetCapture(this); |
1029 drag_controller_.reset(new TabDragController); | 1029 drag_controller_.reset(new TabDragController); |
1030 drag_controller_->Init( | 1030 drag_controller_->Init( |
1031 this, tab, tabs, gfx::Point(x, y), tab->GetMirroredXInView(event.x()), | 1031 this, tab, tabs, gfx::Point(x, y), tab->GetMirroredXInView(event.x()), |
1032 selection_model, detach_behavior, move_behavior); | 1032 selection_model, detach_behavior, move_behavior); |
1033 } | 1033 } |
1034 | 1034 |
1035 void TabStrip::ContinueDrag(views::View* view, const gfx::Point& location) { | 1035 void TabStrip::ContinueDrag(views::View* view, const gfx::Point& location) { |
1036 if (drag_controller_.get()) { | 1036 if (drag_controller_.get()) { |
1037 gfx::Point screen_location(location); | 1037 gfx::Point screen_location(location); |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2348 | 2348 |
2349 int mini_tab_count = GetMiniTabCount(); | 2349 int mini_tab_count = GetMiniTabCount(); |
2350 int normal_count = tab_count() - mini_tab_count; | 2350 int normal_count = tab_count() - mini_tab_count; |
2351 if (normal_count <= 1 || normal_count == mini_tab_count) | 2351 if (normal_count <= 1 || normal_count == mini_tab_count) |
2352 return false; | 2352 return false; |
2353 int x = GetStartXForNormalTabs(); | 2353 int x = GetStartXForNormalTabs(); |
2354 int available_width = width() - x - new_tab_button_width(); | 2354 int available_width = width() - x - new_tab_button_width(); |
2355 return (Tab::GetTouchWidth() * normal_count + | 2355 return (Tab::GetTouchWidth() * normal_count + |
2356 tab_h_offset() * (normal_count - 1)) > available_width; | 2356 tab_h_offset() * (normal_count - 1)) > available_width; |
2357 } | 2357 } |
OLD | NEW |