OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/shelf/app_list_button.h" | 5 #include "ash/shelf/app_list_button.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
| 10 #include "ash/metrics/voice_interaction_metrics.h" |
10 #include "ash/public/cpp/shelf_types.h" | 11 #include "ash/public/cpp/shelf_types.h" |
11 #include "ash/shelf/ink_drop_button_listener.h" | 12 #include "ash/shelf/ink_drop_button_listener.h" |
12 #include "ash/shelf/shelf_constants.h" | 13 #include "ash/shelf/shelf_constants.h" |
13 #include "ash/shelf/shelf_view.h" | 14 #include "ash/shelf/shelf_view.h" |
14 #include "ash/shelf/wm_shelf.h" | 15 #include "ash/shelf/wm_shelf.h" |
15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
16 #include "ash/strings/grit/ash_strings.h" | 17 #include "ash/strings/grit/ash_strings.h" |
17 #include "ash/system/tray/tray_popup_utils.h" | 18 #include "ash/system/tray/tray_popup_utils.h" |
18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
19 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/histogram_macros.h" |
20 #include "chromeos/chromeos_switches.h" | 22 #include "chromeos/chromeos_switches.h" |
21 #include "ui/accessibility/ax_node_data.h" | 23 #include "ui/accessibility/ax_node_data.h" |
22 #include "ui/app_list/presenter/app_list.h" | 24 #include "ui/app_list/presenter/app_list.h" |
23 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/gfx/canvas.h" | 26 #include "ui/gfx/canvas.h" |
25 #include "ui/gfx/scoped_canvas.h" | 27 #include "ui/gfx/scoped_canvas.h" |
26 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 28 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
27 #include "ui/views/animation/ink_drop_impl.h" | 29 #include "ui/views/animation/ink_drop_impl.h" |
28 #include "ui/views/animation/ink_drop_mask.h" | 30 #include "ui/views/animation/ink_drop_mask.h" |
29 #include "ui/views/painter.h" | 31 #include "ui/views/painter.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 shelf_view_->PointerReleasedOnButton(this, ShelfView::TOUCH, false); | 90 shelf_view_->PointerReleasedOnButton(this, ShelfView::TOUCH, false); |
89 event->SetHandled(); | 91 event->SetHandled(); |
90 return; | 92 return; |
91 case ui::ET_GESTURE_TAP_DOWN: | 93 case ui::ET_GESTURE_TAP_DOWN: |
92 if (!Shell::Get()->IsAppListVisible()) | 94 if (!Shell::Get()->IsAppListVisible()) |
93 AnimateInkDrop(views::InkDropState::ACTION_PENDING, event); | 95 AnimateInkDrop(views::InkDropState::ACTION_PENDING, event); |
94 ImageButton::OnGestureEvent(event); | 96 ImageButton::OnGestureEvent(event); |
95 break; | 97 break; |
96 case ui::ET_GESTURE_LONG_PRESS: | 98 case ui::ET_GESTURE_LONG_PRESS: |
97 if (chromeos::switches::IsVoiceInteractionEnabled()) { | 99 if (chromeos::switches::IsVoiceInteractionEnabled()) { |
| 100 UMA_HISTOGRAM_ENUMERATION( |
| 101 "VoiceInteraction.EntryPoints", |
| 102 ash::VoiceInteractionEntry::LONG_PRESS_APP_LIST_BUTTON, |
| 103 ash::VoiceInteractionEntry::COUNT); |
98 Shell::Get()->app_list()->StartVoiceInteractionSession(); | 104 Shell::Get()->app_list()->StartVoiceInteractionSession(); |
99 event->SetHandled(); | 105 event->SetHandled(); |
100 } else { | 106 } else { |
101 ImageButton::OnGestureEvent(event); | 107 ImageButton::OnGestureEvent(event); |
102 } | 108 } |
103 break; | 109 break; |
104 case ui::ET_GESTURE_LONG_TAP: | 110 case ui::ET_GESTURE_LONG_TAP: |
105 if (chromeos::switches::IsVoiceInteractionEnabled()) { | 111 if (chromeos::switches::IsVoiceInteractionEnabled()) { |
106 // Also consume the long tap event. This happens after the user long | 112 // Also consume the long tap event. This happens after the user long |
107 // presses and lifts the finger. We already handled the long press | 113 // presses and lifts the finger. We already handled the long press |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 return gfx::Point(x_mid, x_mid); | 240 return gfx::Point(x_mid, x_mid); |
235 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { | 241 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { |
236 return gfx::Point(y_mid, y_mid); | 242 return gfx::Point(y_mid, y_mid); |
237 } else { | 243 } else { |
238 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); | 244 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); |
239 return gfx::Point(width() - y_mid, y_mid); | 245 return gfx::Point(width() - y_mid, y_mid); |
240 } | 246 } |
241 } | 247 } |
242 | 248 |
243 } // namespace ash | 249 } // namespace ash |
OLD | NEW |