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 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 // Add an observer so we know when the mouse moves out of the tabstrip. | 2622 // Add an observer so we know when the mouse moves out of the tabstrip. |
2623 if (reset_to_shrink_on_exit_) | 2623 if (reset_to_shrink_on_exit_) |
2624 AddMessageLoopObserver(); | 2624 AddMessageLoopObserver(); |
2625 else | 2625 else |
2626 RemoveMessageLoopObserver(); | 2626 RemoveMessageLoopObserver(); |
2627 } | 2627 } |
2628 | 2628 |
2629 void TabStrip::ButtonPressed(views::Button* sender, const ui::Event& event) { | 2629 void TabStrip::ButtonPressed(views::Button* sender, const ui::Event& event) { |
2630 if (sender == newtab_button_) { | 2630 if (sender == newtab_button_) { |
2631 content::RecordAction(UserMetricsAction("NewTab_Button")); | 2631 content::RecordAction(UserMetricsAction("NewTab_Button")); |
| 2632 // TODO(bruthig): |
2632 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_BUTTON, | 2633 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_BUTTON, |
2633 TabStripModel::NEW_TAB_ENUM_COUNT); | 2634 TabStripModel::NEW_TAB_ENUM_COUNT); |
2634 if (event.IsMouseEvent()) { | 2635 if (event.IsMouseEvent()) { |
2635 const ui::MouseEvent& mouse = static_cast<const ui::MouseEvent&>(event); | 2636 const ui::MouseEvent& mouse = static_cast<const ui::MouseEvent&>(event); |
2636 if (mouse.IsOnlyMiddleMouseButton()) { | 2637 if (mouse.IsOnlyMiddleMouseButton()) { |
2637 base::string16 clipboard_text = GetClipboardText(); | 2638 base::string16 clipboard_text = GetClipboardText(); |
2638 if (!clipboard_text.empty()) | 2639 if (!clipboard_text.empty()) |
2639 controller()->CreateNewTabWithLocation(clipboard_text); | 2640 controller()->CreateNewTabWithLocation(clipboard_text); |
2640 return; | 2641 return; |
2641 } | 2642 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2728 break; | 2729 break; |
2729 | 2730 |
2730 case ui::ET_GESTURE_TAP: { | 2731 case ui::ET_GESTURE_TAP: { |
2731 const int active_index = controller_->GetActiveIndex(); | 2732 const int active_index = controller_->GetActiveIndex(); |
2732 DCHECK_NE(-1, active_index); | 2733 DCHECK_NE(-1, active_index); |
2733 Tab* active_tab = tab_at(active_index); | 2734 Tab* active_tab = tab_at(active_index); |
2734 TouchUMA::GestureActionType action = TouchUMA::GESTURE_TABNOSWITCH_TAP; | 2735 TouchUMA::GestureActionType action = TouchUMA::GESTURE_TABNOSWITCH_TAP; |
2735 if (active_tab->tab_activated_with_last_tap_down()) | 2736 if (active_tab->tab_activated_with_last_tap_down()) |
2736 action = TouchUMA::GESTURE_TABSWITCH_TAP; | 2737 action = TouchUMA::GESTURE_TABSWITCH_TAP; |
2737 TouchUMA::RecordGestureAction(action); | 2738 TouchUMA::RecordGestureAction(action); |
| 2739 // TODO(bruthig): |
2738 break; | 2740 break; |
2739 } | 2741 } |
2740 | 2742 |
2741 default: | 2743 default: |
2742 break; | 2744 break; |
2743 } | 2745 } |
2744 event->SetHandled(); | 2746 event->SetHandled(); |
2745 } | 2747 } |
2746 | 2748 |
2747 views::View* TabStrip::TargetForRect(views::View* root, const gfx::Rect& rect) { | 2749 views::View* TabStrip::TargetForRect(views::View* root, const gfx::Rect& rect) { |
(...skipping 19 matching lines...) Expand all Loading... |
2767 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2769 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2768 if (view) | 2770 if (view) |
2769 return view; | 2771 return view; |
2770 } | 2772 } |
2771 Tab* tab = FindTabForEvent(point); | 2773 Tab* tab = FindTabForEvent(point); |
2772 if (tab) | 2774 if (tab) |
2773 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2775 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2774 } | 2776 } |
2775 return this; | 2777 return this; |
2776 } | 2778 } |
OLD | NEW |