| Index: ash/accelerators/accelerator_controller.cc
|
| diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
|
| index d29f1870401c63dd33885574ebff45c987bd7c0b..6eb68a3921409ddb09a7388551f83661ff71e866 100644
|
| --- a/ash/accelerators/accelerator_controller.cc
|
| +++ b/ash/accelerators/accelerator_controller.cc
|
| @@ -38,7 +38,6 @@
|
| #include "ash/system/brightness_control_delegate.h"
|
| #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h"
|
| #include "ash/system/status_area_widget.h"
|
| -#include "ash/system/system_notifier.h"
|
| #include "ash/system/tray/system_tray.h"
|
| #include "ash/system/tray/system_tray_delegate.h"
|
| #include "ash/system/tray/system_tray_notifier.h"
|
| @@ -56,21 +55,16 @@
|
| #include "ash/wm/wm_event.h"
|
| #include "base/bind.h"
|
| #include "base/command_line.h"
|
| -#include "base/metrics/histogram_macros.h"
|
| #include "base/metrics/user_metrics.h"
|
| #include "ui/aura/env.h"
|
| #include "ui/base/accelerators/accelerator.h"
|
| #include "ui/base/accelerators/accelerator_manager.h"
|
| -#include "ui/base/l10n/l10n_util.h"
|
| #include "ui/compositor/layer.h"
|
| #include "ui/compositor/layer_animation_sequence.h"
|
| #include "ui/compositor/layer_animator.h"
|
| #include "ui/events/event.h"
|
| #include "ui/events/keycodes/keyboard_codes.h"
|
| #include "ui/gfx/screen.h"
|
| -#include "ui/message_center/message_center.h"
|
| -#include "ui/message_center/notification.h"
|
| -#include "ui/message_center/notifier_settings.h"
|
| #include "ui/views/controls/webview/webview.h"
|
|
|
| #if defined(OS_CHROMEOS)
|
| @@ -85,37 +79,6 @@ namespace {
|
|
|
| using base::UserMetricsAction;
|
|
|
| -inline ui::Accelerator CreateAccelerator(ui::KeyboardCode keycode,
|
| - 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());
|
| -}
|
| -
|
| -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);
|
| -}
|
| -
|
| bool CanHandleAccessibleFocusCycle() {
|
| if (!Shell::GetInstance()->accessibility_delegate()->
|
| IsSpokenFeedbackEnabled()) {
|
| @@ -795,11 +758,6 @@ bool AcceleratorController::IsReserved(
|
| return reserved_actions_.find(iter->second) != reserved_actions_.end();
|
| }
|
|
|
| -bool AcceleratorController::IsDeprecated(
|
| - const ui::Accelerator& accelerator) const {
|
| - return deprecated_accelerators_.count(accelerator) != 0;
|
| -}
|
| -
|
| bool AcceleratorController::PerformActionIfEnabled(AcceleratorAction action) {
|
| if (CanPerformAction(action, ui::Accelerator())) {
|
| PerformAction(action, ui::Accelerator());
|
| @@ -875,11 +833,6 @@ void AcceleratorController::Init() {
|
|
|
| RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength);
|
|
|
| -#if defined(OS_CHROMEOS)
|
| - RegisterDeprecatedAccelerators(kDeprecatedAccelerators,
|
| - kDeprecatedAcceleratorsLength);
|
| -#endif // defined(OS_CHROMEOS)
|
| -
|
| if (debug::DebugAcceleratorsEnabled()) {
|
| RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength);
|
| // All debug accelerators are reserved.
|
| @@ -897,33 +850,16 @@ void AcceleratorController::RegisterAccelerators(
|
| const AcceleratorData accelerators[],
|
| size_t accelerators_length) {
|
| for (size_t i = 0; i < accelerators_length; ++i) {
|
| - ui::Accelerator accelerator =
|
| - CreateAccelerator(accelerators[i].keycode, accelerators[i].modifiers,
|
| - accelerators[i].trigger_on_press);
|
| + ui::Accelerator accelerator(accelerators[i].keycode,
|
| + accelerators[i].modifiers);
|
| + accelerator.set_type(accelerators[i].trigger_on_press ?
|
| + ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED);
|
| Register(accelerator, this);
|
| accelerators_.insert(
|
| std::make_pair(accelerator, accelerators[i].action));
|
| }
|
| }
|
|
|
| -void AcceleratorController::RegisterDeprecatedAccelerators(
|
| - const DeprecatedAcceleratorData deprecated_accelerators[],
|
| - size_t length) {
|
| - for (size_t i = 0; i < length; ++i) {
|
| - const DeprecatedAcceleratorData* data = &deprecated_accelerators[i];
|
| - const AcceleratorAction action = data->deprecated_accelerator.action;
|
| - const ui::Accelerator deprecated_accelerator =
|
| - CreateAccelerator(data->deprecated_accelerator.keycode,
|
| - data->deprecated_accelerator.modifiers,
|
| - data->deprecated_accelerator.trigger_on_press);
|
| -
|
| - Register(deprecated_accelerator, this);
|
| - actions_with_deprecations_[action] = data;
|
| - accelerators_[deprecated_accelerator] = action;
|
| - deprecated_accelerators_.insert(deprecated_accelerator);
|
| - }
|
| -}
|
| -
|
| bool AcceleratorController::CanPerformAction(
|
| AcceleratorAction action,
|
| const ui::Accelerator& accelerator) {
|
| @@ -932,29 +868,6 @@ bool AcceleratorController::CanPerformAction(
|
| return false;
|
| }
|
|
|
| - // Handling the deprecated accelerators.
|
| - auto itr = actions_with_deprecations_.find(action);
|
| - if (itr != actions_with_deprecations_.end()) {
|
| - const DeprecatedAcceleratorData* data = itr->second;
|
| - if (deprecated_accelerators_.count(accelerator)) {
|
| - // This accelerator has been deprecated and should be treated according
|
| - // to its |DeprecatedAcceleratorData|.
|
| -
|
| - // Record UMA stats.
|
| - RecordUmaHistogram(data->uma_histogram_name, DEPRECATED_USED);
|
| -
|
| - // We always display the notification as long as this entry exists.
|
| - ShowDeprecatedAcceleratorNotification(data->notification_message_id);
|
| -
|
| - if (!data->deprecated_enabled)
|
| - return false;
|
| - } else {
|
| - // This is a new accelerator replacing the old deprecated one.
|
| - // Record UMA stats and proceed normally.
|
| - RecordUmaHistogram(data->uma_histogram_name, NEW_USED);
|
| - }
|
| - }
|
| -
|
| AcceleratorProcessingRestriction restriction =
|
| GetAcceleratorProcessingRestriction(action);
|
| if (restriction != RESTRICTION_NONE)
|
|
|