| 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/public/cpp/shelf_types.h" | 10 #include "ash/public/cpp/shelf_types.h" |
| 11 #include "ash/shelf/ink_drop_button_listener.h" | 11 #include "ash/shelf/ink_drop_button_listener.h" |
| 12 #include "ash/shelf/shelf_constants.h" | 12 #include "ash/shelf/shelf_constants.h" |
| 13 #include "ash/shelf/shelf_view.h" | 13 #include "ash/shelf/shelf_view.h" |
| 14 #include "ash/shelf/wm_shelf.h" | 14 #include "ash/shelf/wm_shelf.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/strings/grit/ash_strings.h" | 16 #include "ash/strings/grit/ash_strings.h" |
| 17 #include "ash/system/tray/tray_popup_utils.h" | 17 #include "ash/system/tray/tray_popup_utils.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
| 20 #include "base/metrics/user_metrics.h" |
| 21 #include "base/metrics/user_metrics_action.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 base::RecordAction(base::UserMetricsAction( |
| 101 "VoiceInteraction.Started.AppListButtonLongPress")); |
| 98 Shell::Get()->app_list()->StartVoiceInteractionSession(); | 102 Shell::Get()->app_list()->StartVoiceInteractionSession(); |
| 99 event->SetHandled(); | 103 event->SetHandled(); |
| 100 } else { | 104 } else { |
| 101 ImageButton::OnGestureEvent(event); | 105 ImageButton::OnGestureEvent(event); |
| 102 } | 106 } |
| 103 break; | 107 break; |
| 104 case ui::ET_GESTURE_LONG_TAP: | 108 case ui::ET_GESTURE_LONG_TAP: |
| 105 if (chromeos::switches::IsVoiceInteractionEnabled()) { | 109 if (chromeos::switches::IsVoiceInteractionEnabled()) { |
| 106 // Also consume the long tap event. This happens after the user long | 110 // Also consume the long tap event. This happens after the user long |
| 107 // presses and lifts the finger. We already handled the long press | 111 // 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); | 238 return gfx::Point(x_mid, x_mid); |
| 235 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { | 239 } else if (alignment == SHELF_ALIGNMENT_RIGHT) { |
| 236 return gfx::Point(y_mid, y_mid); | 240 return gfx::Point(y_mid, y_mid); |
| 237 } else { | 241 } else { |
| 238 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); | 242 DCHECK_EQ(alignment, SHELF_ALIGNMENT_LEFT); |
| 239 return gfx::Point(width() - y_mid, y_mid); | 243 return gfx::Point(width() - y_mid, y_mid); |
| 240 } | 244 } |
| 241 } | 245 } |
| 242 | 246 |
| 243 } // namespace ash | 247 } // namespace ash |
| OLD | NEW |