Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 2898273002: Move Voice Interaction shortcut to accelerator_controller.cc (Closed)
Patch Set: Move Voice Interaction shortcut to accelerator_controller.cc Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/accelerators/accelerator_commands.h" 9 #include "ash/accelerators/accelerator_commands.h"
10 #include "ash/accelerators/accelerator_controller_delegate.h" 10 #include "ash/accelerators/accelerator_controller_delegate.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "ash/wm/window_cycle_controller.h" 43 #include "ash/wm/window_cycle_controller.h"
44 #include "ash/wm/window_positioning_utils.h" 44 #include "ash/wm/window_positioning_utils.h"
45 #include "ash/wm/window_state.h" 45 #include "ash/wm/window_state.h"
46 #include "ash/wm/window_util.h" 46 #include "ash/wm/window_util.h"
47 #include "ash/wm/wm_event.h" 47 #include "ash/wm/wm_event.h"
48 #include "ash/wm_window.h" 48 #include "ash/wm_window.h"
49 #include "base/metrics/histogram_macros.h" 49 #include "base/metrics/histogram_macros.h"
50 #include "base/metrics/user_metrics.h" 50 #include "base/metrics/user_metrics.h"
51 #include "base/strings/string_split.h" 51 #include "base/strings/string_split.h"
52 #include "base/strings/utf_string_conversions.h" 52 #include "base/strings/utf_string_conversions.h"
53 #include "chromeos/chromeos_switches.h"
53 #include "chromeos/dbus/dbus_thread_manager.h" 54 #include "chromeos/dbus/dbus_thread_manager.h"
54 #include "chromeos/dbus/power_manager_client.h" 55 #include "chromeos/dbus/power_manager_client.h"
56 #include "ui/app_list/presenter/app_list.h"
55 #include "ui/base/accelerators/accelerator.h" 57 #include "ui/base/accelerators/accelerator.h"
56 #include "ui/base/accelerators/accelerator_manager.h" 58 #include "ui/base/accelerators/accelerator_manager.h"
57 #include "ui/base/ime/chromeos/ime_keyboard.h" 59 #include "ui/base/ime/chromeos/ime_keyboard.h"
58 #include "ui/base/ime/chromeos/input_method_manager.h" 60 #include "ui/base/ime/chromeos/input_method_manager.h"
59 #include "ui/base/l10n/l10n_util.h" 61 #include "ui/base/l10n/l10n_util.h"
60 #include "ui/compositor/layer.h" 62 #include "ui/compositor/layer.h"
61 #include "ui/compositor/layer_animation_sequence.h" 63 #include "ui/compositor/layer_animation_sequence.h"
62 #include "ui/compositor/layer_animator.h" 64 #include "ui/compositor/layer_animator.h"
63 #include "ui/gfx/paint_vector_icon.h" 65 #include "ui/gfx/paint_vector_icon.h"
64 #include "ui/keyboard/keyboard_controller.h" 66 #include "ui/keyboard/keyboard_controller.h"
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 ->GetShelf() 531 ->GetShelf()
530 ->GetStatusAreaWidget() 532 ->GetStatusAreaWidget()
531 ->palette_tray() 533 ->palette_tray()
532 ->ShowPalette(); 534 ->ShowPalette();
533 } 535 }
534 536
535 bool CanHandleShowStylusTools() { 537 bool CanHandleShowStylusTools() {
536 return palette_utils::ShouldShowPalette(); 538 return palette_utils::ShouldShowPalette();
537 } 539 }
538 540
541 bool CanHandleStartVoiceInteraction() {
542 return chromeos::switches::IsVoiceInteractionEnabled();
543 }
544
545 void HandleStartVoiceInteraction(const ui::Accelerator& accelerator) {
546 if (accelerator.IsCmdDown() && accelerator.key_code() == ui::VKEY_SPACE) {
547 base::RecordAction(
548 base::UserMetricsAction("VoiceInteraction.Started.Search_Space"));
549 } else if (accelerator.IsCmdDown() && accelerator.key_code() == ui::VKEY_A) {
550 base::RecordAction(
551 base::UserMetricsAction("VoiceInteraction.Started.Search_A"));
552 }
553 Shell::Get()->app_list()->StartVoiceInteractionSession();
554 }
555
539 void HandleSuspend() { 556 void HandleSuspend() {
540 base::RecordAction(UserMetricsAction("Accel_Suspend")); 557 base::RecordAction(UserMetricsAction("Accel_Suspend"));
541 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend(); 558 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->RequestSuspend();
542 } 559 }
543 560
544 bool CanHandleCycleUser() { 561 bool CanHandleCycleUser() {
545 return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() && 562 return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() &&
546 Shell::Get()->session_controller()->NumberOfLoggedInUsers() > 1; 563 Shell::Get()->session_controller()->NumberOfLoggedInUsers() > 1;
547 } 564 }
548 565
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 case NEW_INCOGNITO_WINDOW: 943 case NEW_INCOGNITO_WINDOW:
927 return CanHandleNewIncognitoWindow(); 944 return CanHandleNewIncognitoWindow();
928 case NEXT_IME: 945 case NEXT_IME:
929 return CanCycleInputMethod(); 946 return CanCycleInputMethod();
930 case PREVIOUS_IME: 947 case PREVIOUS_IME:
931 return CanCycleInputMethod(); 948 return CanCycleInputMethod();
932 case SHOW_MESSAGE_CENTER_BUBBLE: 949 case SHOW_MESSAGE_CENTER_BUBBLE:
933 return CanHandleShowMessageCenterBubble(); 950 return CanHandleShowMessageCenterBubble();
934 case SHOW_STYLUS_TOOLS: 951 case SHOW_STYLUS_TOOLS:
935 return CanHandleShowStylusTools(); 952 return CanHandleShowStylusTools();
953 case START_VOICE_INTERACTION:
954 return CanHandleStartVoiceInteraction();
936 case SWITCH_IME: 955 case SWITCH_IME:
937 return CanHandleSwitchIme(accelerator); 956 return CanHandleSwitchIme(accelerator);
938 case SWITCH_TO_PREVIOUS_USER: 957 case SWITCH_TO_PREVIOUS_USER:
939 case SWITCH_TO_NEXT_USER: 958 case SWITCH_TO_NEXT_USER:
940 return CanHandleCycleUser(); 959 return CanHandleCycleUser();
941 case TOGGLE_APP_LIST: 960 case TOGGLE_APP_LIST:
942 return CanHandleToggleAppList(accelerator, previous_accelerator); 961 return CanHandleToggleAppList(accelerator, previous_accelerator);
943 case TOGGLE_CAPS_LOCK: 962 case TOGGLE_CAPS_LOCK:
944 return CanHandleToggleCapsLock(accelerator, previous_accelerator); 963 return CanHandleToggleCapsLock(accelerator, previous_accelerator);
945 case WINDOW_CYCLE_SNAP_LEFT: 964 case WINDOW_CYCLE_SNAP_LEFT:
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 break; 1181 break;
1163 case SHOW_STYLUS_TOOLS: 1182 case SHOW_STYLUS_TOOLS:
1164 HandleShowStylusTools(); 1183 HandleShowStylusTools();
1165 break; 1184 break;
1166 case SHOW_SYSTEM_TRAY_BUBBLE: 1185 case SHOW_SYSTEM_TRAY_BUBBLE:
1167 HandleShowSystemTrayBubble(); 1186 HandleShowSystemTrayBubble();
1168 break; 1187 break;
1169 case SHOW_TASK_MANAGER: 1188 case SHOW_TASK_MANAGER:
1170 HandleShowTaskManager(); 1189 HandleShowTaskManager();
1171 break; 1190 break;
1191 case START_VOICE_INTERACTION:
1192 HandleStartVoiceInteraction(accelerator);
1193 break;
1172 case SUSPEND: 1194 case SUSPEND:
1173 HandleSuspend(); 1195 HandleSuspend();
1174 break; 1196 break;
1175 case SWITCH_IME: 1197 case SWITCH_IME:
1176 HandleSwitchIme(accelerator); 1198 HandleSwitchIme(accelerator);
1177 break; 1199 break;
1178 case SWITCH_TO_NEXT_USER: 1200 case SWITCH_TO_NEXT_USER:
1179 HandleCycleUser(CycleUserDirection::NEXT); 1201 HandleCycleUser(CycleUserDirection::NEXT);
1180 break; 1202 break;
1181 case SWITCH_TO_PREVIOUS_USER: 1203 case SWITCH_TO_PREVIOUS_USER:
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 data->uma_histogram_name, data->notification_message_id, 1333 data->uma_histogram_name, data->notification_message_id,
1312 data->old_shortcut_id, data->new_shortcut_id); 1334 data->old_shortcut_id, data->new_shortcut_id);
1313 1335
1314 if (!data->deprecated_enabled) 1336 if (!data->deprecated_enabled)
1315 return AcceleratorProcessingStatus::STOP; 1337 return AcceleratorProcessingStatus::STOP;
1316 1338
1317 return AcceleratorProcessingStatus::PROCEED; 1339 return AcceleratorProcessingStatus::PROCEED;
1318 } 1340 }
1319 1341
1320 } // namespace ash 1342 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698