Chromium Code Reviews| Index: ash/accelerators/accelerator_controller.cc |
| diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc |
| index 6eb68a3921409ddb09a7388551f83661ff71e866..54a3862f2e67b64fabfc225eaa5400f9127daf84 100644 |
| --- a/ash/accelerators/accelerator_controller.cc |
| +++ b/ash/accelerators/accelerator_controller.cc |
| @@ -79,35 +79,35 @@ namespace { |
| using base::UserMetricsAction; |
| -bool CanHandleAccessibleFocusCycle() { |
| - if (!Shell::GetInstance()->accessibility_delegate()-> |
| - IsSpokenFeedbackEnabled()) { |
| - return false; |
| - } |
| - aura::Window* active_window = ash::wm::GetActiveWindow(); |
| - if (!active_window) |
| - return false; |
| - views::Widget* widget = |
| - views::Widget::GetWidgetForNativeWindow(active_window); |
| - if (!widget) |
| - return false; |
| - views::FocusManager* focus_manager = widget->GetFocusManager(); |
| - if (!focus_manager) |
| - return false; |
| - views::View* view = focus_manager->GetFocusedView(); |
| - return view && strcmp(view->GetClassName(), views::WebView::kViewClassName); |
| -} |
| - |
| -void HandleAccessibleFocusCycle(bool reverse) { |
| - if (reverse) |
| - base::RecordAction(UserMetricsAction("Accel_Accessible_Focus_Previous")); |
| - else |
| - base::RecordAction(UserMetricsAction("Accel_Accessible_Focus_Next")); |
| - |
| - aura::Window* active_window = ash::wm::GetActiveWindow(); |
| - views::Widget* widget = |
| - views::Widget::GetWidgetForNativeWindow(active_window); |
| - widget->GetFocusManager()->AdvanceFocus(reverse); |
| +inline ui::Accelerator CreateAccelerator(ui::KeyboardCode keycode, |
|
oshima
2015/06/24 22:14:33
remove "inline"
David Tseng
2015/06/24 22:24:27
Acknowledged.
|
| + int modifiers, |
| + bool trigger_on_press) { |
| + ui::Accelerator accelerator(keycode, modifiers); |
| + accelerator.set_type(trigger_on_press ? ui::ET_KEY_PRESSED |
| + : ui::ET_KEY_RELEASED); |
| + return accelerator; |
| +} |
| + |
| +void ShowDeprecatedAcceleratorNotification(int message_id) { |
| + const base::string16 message = l10n_util::GetStringUTF16(message_id); |
| + scoped_ptr<message_center::Notification> notification( |
| + new message_center::Notification( |
| + message_center::NOTIFICATION_TYPE_SIMPLE, |
| + kDeprecatedAcceleratorNotificationId, base::string16(), message, |
| + gfx::Image(), base::string16(), |
| + message_center::NotifierId( |
| + message_center::NotifierId::SYSTEM_COMPONENT, |
| + system_notifier::kNotifierDeprecatedAccelerator), |
| + message_center::RichNotificationData(), nullptr)); |
| + message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
| +} |
|
oshima
2015/06/24 22:14:33
These changes were reverted yesterday (https://cod
David Tseng
2015/06/24 22:24:27
Done.
|
| + |
| +void RecordUmaHistogram(const char* histogram_name, |
| + DeprecatedAcceleratorUsage sample) { |
| + auto histogram = base::LinearHistogram::FactoryGet( |
| + histogram_name, 1, DEPRECATED_USAGE_COUNT, DEPRECATED_USAGE_COUNT + 1, |
| + base::HistogramBase::kUmaTargetedHistogramFlag); |
| + histogram->Add(sample); |
| } |
| void HandleCycleBackwardMRU(const ui::Accelerator& accelerator) { |
| @@ -880,9 +880,6 @@ bool AcceleratorController::CanPerformAction( |
| // false should be returned to give the web contents a chance at handling the |
| // accelerator. |
| switch (action) { |
| - case ACCESSIBLE_FOCUS_NEXT: |
| - case ACCESSIBLE_FOCUS_PREVIOUS: |
| - return CanHandleAccessibleFocusCycle(); |
| case DEBUG_PRINT_LAYER_HIERARCHY: |
| case DEBUG_PRINT_VIEW_HIERARCHY: |
| case DEBUG_PRINT_WINDOW_HIERARCHY: |
| @@ -1013,12 +1010,6 @@ void AcceleratorController::PerformAction(AcceleratorAction action, |
| // implement it in your module's controller code (like TOGGLE_MIRROR_MODE |
| // below) or pull it into a HandleFoo() function above. |
| switch (action) { |
| - case ACCESSIBLE_FOCUS_NEXT: |
| - HandleAccessibleFocusCycle(false); |
| - break; |
| - case ACCESSIBLE_FOCUS_PREVIOUS: |
| - HandleAccessibleFocusCycle(true); |
| - break; |
| case CYCLE_BACKWARD_MRU: |
| HandleCycleBackwardMRU(accelerator); |
| break; |