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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "ui/views/rect_based_targeting_utils.h" | 52 #include "ui/views/rect_based_targeting_utils.h" |
53 #include "ui/views/view_model_utils.h" | 53 #include "ui/views/view_model_utils.h" |
54 #include "ui/views/widget/root_view.h" | 54 #include "ui/views/widget/root_view.h" |
55 #include "ui/views/widget/widget.h" | 55 #include "ui/views/widget/widget.h" |
56 #include "ui/views/window/non_client_view.h" | 56 #include "ui/views/window/non_client_view.h" |
57 | 57 |
58 #if defined(OS_WIN) | 58 #if defined(OS_WIN) |
59 #include "ui/gfx/win/hwnd_util.h" | 59 #include "ui/gfx/win/hwnd_util.h" |
60 #include "ui/views/widget/monitor_win.h" | 60 #include "ui/views/widget/monitor_win.h" |
61 #include "ui/views/win/hwnd_util.h" | 61 #include "ui/views/win/hwnd_util.h" |
62 #include "win8/util/win8_util.h" | |
63 #endif | 62 #endif |
64 | 63 |
65 using base::UserMetricsAction; | 64 using base::UserMetricsAction; |
66 using ui::DropTargetEvent; | 65 using ui::DropTargetEvent; |
67 | 66 |
68 namespace { | 67 namespace { |
69 | 68 |
70 static const int kTabStripAnimationVSlop = 40; | 69 static const int kTabStripAnimationVSlop = 40; |
71 // Inactive tabs in a native frame are slightly transparent. | 70 // Inactive tabs in a native frame are slightly transparent. |
72 static const int kGlassFrameInactiveTabAlpha = 200; | 71 static const int kGlassFrameInactiveTabAlpha = 200; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 432 } |
434 | 433 |
435 gfx::ImageSkia NewTabButton::GetBackgroundImage( | 434 gfx::ImageSkia NewTabButton::GetBackgroundImage( |
436 views::CustomButton::ButtonState state, | 435 views::CustomButton::ButtonState state, |
437 ui::ScaleFactor scale_factor) const { | 436 ui::ScaleFactor scale_factor) const { |
438 int background_id = 0; | 437 int background_id = 0; |
439 if (ShouldWindowContentsBeTransparent()) { | 438 if (ShouldWindowContentsBeTransparent()) { |
440 background_id = IDR_THEME_TAB_BACKGROUND_V; | 439 background_id = IDR_THEME_TAB_BACKGROUND_V; |
441 } else if (tab_strip_->controller()->IsIncognito()) { | 440 } else if (tab_strip_->controller()->IsIncognito()) { |
442 background_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; | 441 background_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; |
443 #if defined(OS_WIN) | |
444 } else if (win8::IsSingleWindowMetroMode()) { | |
445 background_id = IDR_THEME_TAB_BACKGROUND_V; | |
446 #endif | |
447 } else { | 442 } else { |
448 background_id = IDR_THEME_TAB_BACKGROUND; | 443 background_id = IDR_THEME_TAB_BACKGROUND; |
449 } | 444 } |
450 | 445 |
451 int alpha = 0; | 446 int alpha = 0; |
452 switch (state) { | 447 switch (state) { |
453 case views::CustomButton::STATE_NORMAL: | 448 case views::CustomButton::STATE_NORMAL: |
454 case views::CustomButton::STATE_HOVERED: | 449 case views::CustomButton::STATE_HOVERED: |
455 alpha = ShouldWindowContentsBeTransparent() ? kGlassFrameInactiveTabAlpha | 450 alpha = ShouldWindowContentsBeTransparent() ? kGlassFrameInactiveTabAlpha |
456 : 255; | 451 : 255; |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 if (touch_layout_.get() && | 1129 if (touch_layout_.get() && |
1135 ((event.type() == ui::ET_MOUSE_PRESSED && | 1130 ((event.type() == ui::ET_MOUSE_PRESSED && |
1136 (((event.flags() & ui::EF_FROM_TOUCH) && | 1131 (((event.flags() & ui::EF_FROM_TOUCH) && |
1137 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || | 1132 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || |
1138 (!(event.flags() & ui::EF_FROM_TOUCH) && | 1133 (!(event.flags() & ui::EF_FROM_TOUCH) && |
1139 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || | 1134 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || |
1140 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { | 1135 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { |
1141 move_behavior = TabDragController::MOVE_VISIBILE_TABS; | 1136 move_behavior = TabDragController::MOVE_VISIBILE_TABS; |
1142 } | 1137 } |
1143 | 1138 |
1144 #if defined(OS_WIN) | |
1145 // It doesn't make sense to drag tabs out on Win8's single window Metro mode. | |
1146 if (win8::IsSingleWindowMetroMode()) | |
1147 detach_behavior = TabDragController::NOT_DETACHABLE; | |
1148 #endif | |
1149 drag_controller_.reset(new TabDragController); | 1139 drag_controller_.reset(new TabDragController); |
1150 drag_controller_->Init( | 1140 drag_controller_->Init( |
1151 this, tab, tabs, gfx::Point(x, y), event.x(), selection_model, | 1141 this, tab, tabs, gfx::Point(x, y), event.x(), selection_model, |
1152 detach_behavior, move_behavior, EventSourceFromEvent(event)); | 1142 detach_behavior, move_behavior, EventSourceFromEvent(event)); |
1153 } | 1143 } |
1154 | 1144 |
1155 void TabStrip::ContinueDrag(views::View* view, const ui::LocatedEvent& event) { | 1145 void TabStrip::ContinueDrag(views::View* view, const ui::LocatedEvent& event) { |
1156 if (drag_controller_.get() && | 1146 if (drag_controller_.get() && |
1157 drag_controller_->event_source() == EventSourceFromEvent(event)) { | 1147 drag_controller_->event_source() == EventSourceFromEvent(event)) { |
1158 gfx::Point screen_location(event.location()); | 1148 gfx::Point screen_location(event.location()); |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 if (!adjust_layout_) | 2753 if (!adjust_layout_) |
2764 return false; | 2754 return false; |
2765 | 2755 |
2766 #if defined(USE_AURA) | 2756 #if defined(USE_AURA) |
2767 return chrome::GetHostDesktopTypeForNativeView( | 2757 return chrome::GetHostDesktopTypeForNativeView( |
2768 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; | 2758 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; |
2769 #else | 2759 #else |
2770 return ui::GetDisplayLayout() == ui::LAYOUT_TOUCH; | 2760 return ui::GetDisplayLayout() == ui::LAYOUT_TOUCH; |
2771 #endif | 2761 #endif |
2772 } | 2762 } |
OLD | NEW |