| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 "ui/base/win/hwnd_util.h" | 54 #include "ui/base/win/hwnd_util.h" |
| 55 #include "ui/views/widget/monitor_win.h" | 55 #include "ui/views/widget/monitor_win.h" |
| 56 #include "win8/util/win8_util.h" | 56 #include "win8/util/win8_util.h" |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 #if defined(USE_ASH) |
| 60 #include "ash/touch/touch_uma.h" |
| 61 |
| 62 using ash::internal::TouchUMA; |
| 63 #endif |
| 64 |
| 59 using content::UserMetricsAction; | 65 using content::UserMetricsAction; |
| 60 using ui::DropTargetEvent; | 66 using ui::DropTargetEvent; |
| 61 | 67 |
| 62 namespace { | 68 namespace { |
| 63 | 69 |
| 64 static const int kTabStripAnimationVSlop = 40; | 70 static const int kTabStripAnimationVSlop = 40; |
| 65 // Inactive tabs in a native frame are slightly transparent. | 71 // Inactive tabs in a native frame are slightly transparent. |
| 66 static const int kNativeFrameInactiveTabAlpha = 200; | 72 static const int kNativeFrameInactiveTabAlpha = 200; |
| 67 // If there are multiple tabs selected then make non-selected inactive tabs | 73 // If there are multiple tabs selected then make non-selected inactive tabs |
| 68 // even more transparent. | 74 // even more transparent. |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 | 1494 |
| 1489 /////////////////////////////////////////////////////////////////////////////// | 1495 /////////////////////////////////////////////////////////////////////////////// |
| 1490 // TabStrip, views::ButtonListener implementation: | 1496 // TabStrip, views::ButtonListener implementation: |
| 1491 | 1497 |
| 1492 void TabStrip::ButtonPressed(views::Button* sender, const ui::Event& event) { | 1498 void TabStrip::ButtonPressed(views::Button* sender, const ui::Event& event) { |
| 1493 if (sender == newtab_button_) { | 1499 if (sender == newtab_button_) { |
| 1494 content::RecordAction(UserMetricsAction("NewTab_Button")); | 1500 content::RecordAction(UserMetricsAction("NewTab_Button")); |
| 1495 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_BUTTON, | 1501 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_BUTTON, |
| 1496 TabStripModel::NEW_TAB_ENUM_COUNT); | 1502 TabStripModel::NEW_TAB_ENUM_COUNT); |
| 1497 controller()->CreateNewTab(); | 1503 controller()->CreateNewTab(); |
| 1504 #if defined(USE_ASH) |
| 1505 if (event.type() == ui::ET_GESTURE_TAP) |
| 1506 TouchUMA::GetInstance()->RecordGestureAction( |
| 1507 TouchUMA::GESTURE_NEWTAB_TAP); |
| 1508 #endif |
| 1498 } | 1509 } |
| 1499 } | 1510 } |
| 1500 | 1511 |
| 1501 /////////////////////////////////////////////////////////////////////////////// | 1512 /////////////////////////////////////////////////////////////////////////////// |
| 1502 // TabStrip, protected: | 1513 // TabStrip, protected: |
| 1503 | 1514 |
| 1504 // Overridden to support automation. See automation_proxy_uitest.cc. | 1515 // Overridden to support automation. See automation_proxy_uitest.cc. |
| 1505 const views::View* TabStrip::GetViewByID(int view_id) const { | 1516 const views::View* TabStrip::GetViewByID(int view_id) const { |
| 1506 if (tab_count() > 0) { | 1517 if (tab_count() > 0) { |
| 1507 if (view_id == VIEW_ID_TAB_LAST) { | 1518 if (view_id == VIEW_ID_TAB_LAST) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 } | 1587 } |
| 1577 | 1588 |
| 1578 case ui::ET_GESTURE_SCROLL_UPDATE: | 1589 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 1579 ContinueDrag(this, *event); | 1590 ContinueDrag(this, *event); |
| 1580 break; | 1591 break; |
| 1581 | 1592 |
| 1582 case ui::ET_GESTURE_BEGIN: | 1593 case ui::ET_GESTURE_BEGIN: |
| 1583 EndDrag(END_DRAG_CANCEL); | 1594 EndDrag(END_DRAG_CANCEL); |
| 1584 break; | 1595 break; |
| 1585 | 1596 |
| 1597 #if defined(USE_ASH) |
| 1598 case ui::ET_GESTURE_TAP: { |
| 1599 const int active_index = controller_->GetActiveIndex(); |
| 1600 DCHECK_NE(-1, active_index); |
| 1601 Tab* active_tab = tab_at(active_index); |
| 1602 TouchUMA::GestureActionType action = TouchUMA::GESTURE_TABNOSWITCH_TAP; |
| 1603 if (active_tab->tab_activated_with_last_gesture_begin()) |
| 1604 action = TouchUMA::GESTURE_TABSWITCH_TAP; |
| 1605 TouchUMA::GetInstance()->RecordGestureAction(action); |
| 1606 break; |
| 1607 } |
| 1608 #endif |
| 1609 |
| 1586 default: | 1610 default: |
| 1587 break; | 1611 break; |
| 1588 } | 1612 } |
| 1589 event->SetHandled(); | 1613 event->SetHandled(); |
| 1590 } | 1614 } |
| 1591 | 1615 |
| 1592 /////////////////////////////////////////////////////////////////////////////// | 1616 /////////////////////////////////////////////////////////////////////////////// |
| 1593 // TabStrip, private: | 1617 // TabStrip, private: |
| 1594 | 1618 |
| 1595 void TabStrip::Init() { | 1619 void TabStrip::Init() { |
| (...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2692 if (!adjust_layout_) | 2716 if (!adjust_layout_) |
| 2693 return false; | 2717 return false; |
| 2694 | 2718 |
| 2695 #if !defined(OS_CHROMEOS) | 2719 #if !defined(OS_CHROMEOS) |
| 2696 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2720 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
| 2697 return false; | 2721 return false; |
| 2698 #endif | 2722 #endif |
| 2699 | 2723 |
| 2700 return true; | 2724 return true; |
| 2701 } | 2725 } |
| OLD | NEW |