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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "ui/gfx/size.h" | 44 #include "ui/gfx/size.h" |
45 #include "ui/views/controls/image_view.h" | 45 #include "ui/views/controls/image_view.h" |
46 #include "ui/views/mouse_watcher_view_host.h" | 46 #include "ui/views/mouse_watcher_view_host.h" |
47 #include "ui/views/view_model_utils.h" | 47 #include "ui/views/view_model_utils.h" |
48 #include "ui/views/widget/default_theme_provider.h" | 48 #include "ui/views/widget/default_theme_provider.h" |
49 #include "ui/views/widget/root_view.h" | 49 #include "ui/views/widget/root_view.h" |
50 #include "ui/views/widget/widget.h" | 50 #include "ui/views/widget/widget.h" |
51 #include "ui/views/window/non_client_view.h" | 51 #include "ui/views/window/non_client_view.h" |
52 | 52 |
53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
54 #include "base/win/metro.h" | |
55 #include "ui/base/win/hwnd_util.h" | 54 #include "ui/base/win/hwnd_util.h" |
56 #include "ui/views/widget/monitor_win.h" | 55 #include "ui/views/widget/monitor_win.h" |
| 56 #include "win8/util/win8_util.h" |
57 #endif | 57 #endif |
58 | 58 |
59 using content::UserMetricsAction; | 59 using content::UserMetricsAction; |
60 using ui::DropTargetEvent; | 60 using ui::DropTargetEvent; |
61 | 61 |
62 namespace { | 62 namespace { |
63 | 63 |
64 static const int kTabStripAnimationVSlop = 40; | 64 static const int kTabStripAnimationVSlop = 40; |
65 // Inactive tabs in a native frame are slightly transparent. | 65 // Inactive tabs in a native frame are slightly transparent. |
66 static const int kNativeFrameInactiveTabAlpha = 200; | 66 static const int kNativeFrameInactiveTabAlpha = 200; |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 gfx::ImageSkia NewTabButton::GetBackgroundImage( | 395 gfx::ImageSkia NewTabButton::GetBackgroundImage( |
396 views::CustomButton::ButtonState state, | 396 views::CustomButton::ButtonState state, |
397 ui::ScaleFactor scale_factor) const { | 397 ui::ScaleFactor scale_factor) const { |
398 int background_id = 0; | 398 int background_id = 0; |
399 if (ShouldUseNativeFrame()) { | 399 if (ShouldUseNativeFrame()) { |
400 background_id = IDR_THEME_TAB_BACKGROUND_V; | 400 background_id = IDR_THEME_TAB_BACKGROUND_V; |
401 } else if (tab_strip_->controller()->IsIncognito()) { | 401 } else if (tab_strip_->controller()->IsIncognito()) { |
402 background_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; | 402 background_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO; |
403 #if defined(OS_WIN) | 403 #if defined(OS_WIN) |
404 } else if (base::win::IsMetroProcess()) { | 404 } else if (win8::IsSingleWindowMetroMode()) { |
405 background_id = IDR_THEME_TAB_BACKGROUND_V; | 405 background_id = IDR_THEME_TAB_BACKGROUND_V; |
406 #endif | 406 #endif |
407 } else { | 407 } else { |
408 background_id = IDR_THEME_TAB_BACKGROUND; | 408 background_id = IDR_THEME_TAB_BACKGROUND; |
409 } | 409 } |
410 | 410 |
411 int alpha = 0; | 411 int alpha = 0; |
412 switch (state) { | 412 switch (state) { |
413 case views::CustomButton::STATE_NORMAL: | 413 case views::CustomButton::STATE_NORMAL: |
414 case views::CustomButton::STATE_HOVERED: | 414 case views::CustomButton::STATE_HOVERED: |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 if (adjust_layout_ && | 1055 if (adjust_layout_ && |
1056 ((event.type() == ui::ET_MOUSE_PRESSED && | 1056 ((event.type() == ui::ET_MOUSE_PRESSED && |
1057 (((event.flags() & ui::EF_FROM_TOUCH) && | 1057 (((event.flags() & ui::EF_FROM_TOUCH) && |
1058 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || | 1058 static_cast<const ui::MouseEvent&>(event).IsLeftMouseButton()) || |
1059 (!(event.flags() & ui::EF_FROM_TOUCH) && | 1059 (!(event.flags() & ui::EF_FROM_TOUCH) && |
1060 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || | 1060 static_cast<const ui::MouseEvent&>(event).IsControlDown()))) || |
1061 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { | 1061 (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { |
1062 move_behavior = TabDragController::MOVE_VISIBILE_TABS; | 1062 move_behavior = TabDragController::MOVE_VISIBILE_TABS; |
1063 } | 1063 } |
1064 #if defined(OS_WIN) | 1064 #if defined(OS_WIN) |
1065 // It doesn't make sense to drag tabs out on metro. | 1065 // It doesn't make sense to drag tabs out on Win8's single window Metro mode. |
1066 if (base::win::IsMetroProcess()) | 1066 if (win8::IsSingleWindowMetroMode()) |
1067 detach_behavior = TabDragController::NOT_DETACHABLE; | 1067 detach_behavior = TabDragController::NOT_DETACHABLE; |
1068 #endif | 1068 #endif |
1069 // Gestures don't automatically do a capture. We don't allow multiple drags at | 1069 // Gestures don't automatically do a capture. We don't allow multiple drags at |
1070 // the same time, so we explicitly capture. | 1070 // the same time, so we explicitly capture. |
1071 if (event.type() == ui::ET_GESTURE_BEGIN) | 1071 if (event.type() == ui::ET_GESTURE_BEGIN) |
1072 GetWidget()->SetCapture(this); | 1072 GetWidget()->SetCapture(this); |
1073 drag_controller_.reset(new TabDragController); | 1073 drag_controller_.reset(new TabDragController); |
1074 drag_controller_->Init( | 1074 drag_controller_->Init( |
1075 this, tab, tabs, gfx::Point(x, y), tab->GetMirroredXInView(event.x()), | 1075 this, tab, tabs, gfx::Point(x, y), tab->GetMirroredXInView(event.x()), |
1076 selection_model, detach_behavior, move_behavior); | 1076 selection_model, detach_behavior, move_behavior); |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 if (!adjust_layout_) | 2571 if (!adjust_layout_) |
2572 return false; | 2572 return false; |
2573 | 2573 |
2574 #if !defined(OS_CHROMEOS) | 2574 #if !defined(OS_CHROMEOS) |
2575 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2575 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
2576 return false; | 2576 return false; |
2577 #endif | 2577 #endif |
2578 | 2578 |
2579 return true; | 2579 return true; |
2580 } | 2580 } |
OLD | NEW |