diff options
author | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 07:52:28 +0000 |
---|---|---|
committer | tengs@chromium.org <tengs@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-20 07:52:28 +0000 |
commit | 08bdabed6431d795ff0a3bccc838b10b9e463efb (patch) | |
tree | 9f9ff38568d617d824117f0d522c8448f551958f /ash | |
parent | 2bf93f2315882ea991d67c6de3824566cbb93cbf (diff) | |
download | chromium_src-08bdabed6431d795ff0a3bccc838b10b9e463efb.zip chromium_src-08bdabed6431d795ff0a3bccc838b10b9e463efb.tar.gz chromium_src-08bdabed6431d795ff0a3bccc838b10b9e463efb.tar.bz2 |
Move sticky keys files to their own directory and rename to StickyKeysController.
There will be new files added for the sticky keys UI in the future, and this
refactor improves organization for sticky keys code and is more inline with how
the other accessibility features are organized.
TEST=StickyKeysTests pass
Review URL: https://codereview.chromium.org/118543002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242036 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 12 | ||||
-rw-r--r-- | ash/shell.cc | 8 | ||||
-rw-r--r-- | ash/shell.h | 8 | ||||
-rw-r--r-- | ash/sticky_keys/OWNERS | 1 | ||||
-rw-r--r-- | ash/sticky_keys/sticky_keys_controller.cc (renamed from ash/wm/sticky_keys.cc) | 20 | ||||
-rw-r--r-- | ash/sticky_keys/sticky_keys_controller.h (renamed from ash/wm/sticky_keys.h) | 30 | ||||
-rw-r--r-- | ash/sticky_keys/sticky_keys_unittest.cc (renamed from ash/wm/sticky_keys_unittest.cc) | 8 |
7 files changed, 44 insertions, 43 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 4d7cde1..39798d0 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -242,6 +242,8 @@ 'shell_delegate.h', 'shell_factory.h', 'shell_window_ids.h', + 'sticky_keys/sticky_keys_controller.cc', + 'sticky_keys/sticky_keys_controller.h', 'system/bluetooth/bluetooth_observer.h', 'system/bluetooth/tray_bluetooth.cc', 'system/bluetooth/tray_bluetooth.h', @@ -541,8 +543,6 @@ 'wm/stacking_controller.h', 'wm/status_area_layout_manager.cc', 'wm/status_area_layout_manager.h', - 'wm/sticky_keys.cc', - 'wm/sticky_keys.h', 'wm/system_background_controller.cc', 'wm/system_background_controller.h', 'wm/system_gesture_event_filter.cc', @@ -603,8 +603,8 @@ ['OS=="win"', { 'sources/': [ ['exclude', 'host/root_window_host_factory.cc'], - ['exclude', 'wm/sticky_keys.cc'], - ['exclude', 'wm/sticky_keys.h'], + ['exclude', 'sticky_keys/sticky_keys_controller.cc'], + ['exclude', 'sticky_keys/sticky_keys_controller.h'], ], # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. 'msvs_disabled_warnings': [ 4267, ], @@ -818,6 +818,7 @@ 'shell/window_watcher_shelf_item_delegate.h', 'shell/window_watcher_unittest.cc', 'shell_unittest.cc', + 'sticky_keys/sticky_keys_unittest.cc', 'system/chromeos/managed/tray_locally_managed_user_unittest.cc', 'system/chromeos/network/network_state_notifier_unittest.cc', 'system/chromeos/power/power_event_observer_unittest.cc', @@ -857,7 +858,6 @@ 'wm/screen_dimmer_unittest.cc', 'wm/solo_window_tracker_unittest.cc', 'wm/stacking_controller_unittest.cc', - 'wm/sticky_keys_unittest.cc', 'wm/system_gesture_event_filter_unittest.cc', 'wm/system_modal_container_layout_manager_unittest.cc', 'wm/toplevel_window_event_handler_unittest.cc', @@ -893,7 +893,7 @@ ['exclude', 'ash_root_window_transformer_unittest.cc'], ['exclude', 'magnifier/magnification_controller_unittest.cc'], ['exclude', 'wm/workspace/workspace_window_resizer_unittest.cc'], - ['exclude', 'wm/sticky_keys_unittest.cc'], + ['exclude', 'sticky_keys/sticky_keys_unittest.cc'], ['exclude', 'autoclick/autoclick_unittest.cc'], ], 'sources': [ diff --git a/ash/shell.cc b/ash/shell.cc index d5e7a6e..42c1f77 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -128,12 +128,12 @@ #include "content/public/browser/gpu_data_manager.h" #include "gpu/config/gpu_feature_type.h" #endif // defined(USE_X11) +#include "ash/sticky_keys/sticky_keys_controller.h" #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" #include "ash/system/chromeos/power/power_event_observer.h" #include "ash/system/chromeos/power/power_status.h" #include "ash/system/chromeos/power/user_activity_notifier.h" #include "ash/system/chromeos/power/video_activity_notifier.h" -#include "ash/wm/sticky_keys.h" #endif // defined(OS_CHROMEOS) namespace ash { @@ -801,10 +801,10 @@ void Shell::Init() { AddPreTargetHandler(event_rewriter_filter_.get()); #if defined(OS_CHROMEOS) - // The StickyKeys event filter also rewrites events and must be added + // The StickyKeysController also rewrites events and must be added // before observers, but after the EventRewriterEventFilter. - sticky_keys_.reset(new StickyKeys); - AddPreTargetHandler(sticky_keys_.get()); + sticky_keys_controller_.reset(new StickyKeysController); + AddPreTargetHandler(sticky_keys_controller_.get()); #endif // UserActivityDetector passes events to observers, so let them get diff --git a/ash/shell.h b/ash/shell.h index 4b8ab21..0b77ad8 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -101,7 +101,7 @@ class ShelfItemDelegateManager; class ShelfModel; class ShellDelegate; class ShellObserver; -class StickyKeys; +class StickyKeysController; class SystemTray; class SystemTrayDelegate; class SystemTrayNotifier; @@ -529,8 +529,8 @@ class ASH_EXPORT Shell // returned object. ash::FirstRunHelper* CreateFirstRunHelper(); - StickyKeys* sticky_keys() { - return sticky_keys_.get(); + StickyKeysController* sticky_keys_controller() { + return sticky_keys_controller_.get(); } #endif // defined(OS_CHROMEOS) @@ -675,7 +675,7 @@ class ASH_EXPORT Shell scoped_ptr<internal::PowerEventObserver> power_event_observer_; scoped_ptr<internal::UserActivityNotifier> user_activity_notifier_; scoped_ptr<internal::VideoActivityNotifier> video_activity_notifier_; - scoped_ptr<StickyKeys> sticky_keys_; + scoped_ptr<StickyKeysController> sticky_keys_controller_; #if defined(USE_X11) // Controls video output device state. scoped_ptr<chromeos::OutputConfigurator> output_configurator_; diff --git a/ash/sticky_keys/OWNERS b/ash/sticky_keys/OWNERS new file mode 100644 index 0000000..d12cc95 --- /dev/null +++ b/ash/sticky_keys/OWNERS @@ -0,0 +1 @@ +tengs@chromium.org diff --git a/ash/wm/sticky_keys.cc b/ash/sticky_keys/sticky_keys_controller.cc index 9e2cc2a..a34cded 100644 --- a/ash/wm/sticky_keys.cc +++ b/ash/sticky_keys/sticky_keys_controller.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/wm/sticky_keys.h" +#include "ash/sticky_keys/sticky_keys_controller.h" #if defined(USE_X11) #include <X11/extensions/XInput2.h> @@ -88,7 +88,7 @@ void StickyKeysHandlerDelegateImpl::DispatchScrollEvent( /////////////////////////////////////////////////////////////////////////////// // StickyKeys -StickyKeys::StickyKeys() +StickyKeysController::StickyKeysController() : enabled_(false), shift_sticky_key_( new StickyKeysHandler(ui::EF_SHIFT_DOWN, @@ -101,10 +101,10 @@ StickyKeys::StickyKeys() new StickyKeysHandlerDelegateImpl())) { } -StickyKeys::~StickyKeys() { +StickyKeysController::~StickyKeysController() { } -void StickyKeys::Enable(bool enabled) { +void StickyKeysController::Enable(bool enabled) { if (enabled_ != enabled) { enabled_ = enabled; @@ -124,26 +124,26 @@ void StickyKeys::Enable(bool enabled) { } } -bool StickyKeys::HandleKeyEvent(ui::KeyEvent* event) { +bool StickyKeysController::HandleKeyEvent(ui::KeyEvent* event) { return shift_sticky_key_->HandleKeyEvent(event) || alt_sticky_key_->HandleKeyEvent(event) || ctrl_sticky_key_->HandleKeyEvent(event); return ctrl_sticky_key_->HandleKeyEvent(event); } -bool StickyKeys::HandleMouseEvent(ui::MouseEvent* event) { +bool StickyKeysController::HandleMouseEvent(ui::MouseEvent* event) { return shift_sticky_key_->HandleMouseEvent(event) || alt_sticky_key_->HandleMouseEvent(event) || ctrl_sticky_key_->HandleMouseEvent(event); } -bool StickyKeys::HandleScrollEvent(ui::ScrollEvent* event) { +bool StickyKeysController::HandleScrollEvent(ui::ScrollEvent* event) { return shift_sticky_key_->HandleScrollEvent(event) || alt_sticky_key_->HandleScrollEvent(event) || ctrl_sticky_key_->HandleScrollEvent(event); } -void StickyKeys::OnKeyEvent(ui::KeyEvent* event) { +void StickyKeysController::OnKeyEvent(ui::KeyEvent* event) { // Do not consume a translated key event which is generated by an IME. if (event->type() == ui::ET_TRANSLATED_KEY_PRESS || event->type() == ui::ET_TRANSLATED_KEY_RELEASE) { @@ -154,12 +154,12 @@ void StickyKeys::OnKeyEvent(ui::KeyEvent* event) { event->StopPropagation(); } -void StickyKeys::OnMouseEvent(ui::MouseEvent* event) { +void StickyKeysController::OnMouseEvent(ui::MouseEvent* event) { if (enabled_ && HandleMouseEvent(event)) event->StopPropagation(); } -void StickyKeys::OnScrollEvent(ui::ScrollEvent* event) { +void StickyKeysController::OnScrollEvent(ui::ScrollEvent* event) { if (enabled_ && HandleScrollEvent(event)) event->StopPropagation(); } diff --git a/ash/wm/sticky_keys.h b/ash/sticky_keys/sticky_keys_controller.h index 1a27892..7ab3c69 100644 --- a/ash/wm/sticky_keys.h +++ b/ash/sticky_keys/sticky_keys_controller.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ASH_WM_STICKY_KEYS_H_ -#define ASH_WM_STICKY_KEYS_H_ +#ifndef ASH_WM_STICKY_KEYS_CONTROLLER_H_ +#define ASH_WM_STICKY_KEYS_CONTROLLER_H_ #include "ash/ash_export.h" #include "base/memory/scoped_ptr.h" @@ -24,10 +24,10 @@ namespace ash { class StickyKeysHandler; -// StickyKeys is an accessibility feature for users to be able to compose key -// and mouse event with modifier keys without simultaneous key press event. -// Instead they can compose events separately pressing each of the modifier -// keys involved. +// StickyKeysController is an accessibility feature for users to be able to +// compose key and mouse event with modifier keys without simultaneous key +// press event. Instead they can compose events separately pressing each of the +// modifier keys involved. // e.g. Composing Ctrl + T // User Action : The KeyEvent widget will receives // ---------------------------------------------------------- @@ -53,14 +53,14 @@ class StickyKeysHandler; // 9. Press Ctrl key : No event // 10. Release Ctrl key: Ctrl Keyup // -// In the case of Chrome OS, StickyKeys supports Shift,Alt,Ctrl modifiers. Each -// handling or state is performed independently. +// In the case of Chrome OS, StickyKeysController supports Shift,Alt,Ctrl +// modifiers. Each handling or state is performed independently. // -// StickyKeys is disabled by default. -class ASH_EXPORT StickyKeys : public ui::EventHandler { +// StickyKeysController is disabled by default. +class ASH_EXPORT StickyKeysController : public ui::EventHandler { public: - StickyKeys(); - virtual ~StickyKeys(); + StickyKeysController(); + virtual ~StickyKeysController(); // Activate sticky keys to intercept and modify incoming events. void Enable(bool enabled); @@ -88,10 +88,10 @@ class ASH_EXPORT StickyKeys : public ui::EventHandler { scoped_ptr<StickyKeysHandler> alt_sticky_key_; scoped_ptr<StickyKeysHandler> ctrl_sticky_key_; - DISALLOW_COPY_AND_ASSIGN(StickyKeys); + DISALLOW_COPY_AND_ASSIGN(StickyKeysController); }; -// StickyKeysHandler handles key event and performs StickyKeys for specific +// StickyKeysHandler handles key event and controls sticky keysfor specific // modifier keys. If monitored keyboard events are recieved, StickyKeysHandler // changes internal state. If non modifier keyboard events or mouse events are // received, StickyKeysHandler will append modifier based on internal state. @@ -237,4 +237,4 @@ class ASH_EXPORT StickyKeysHandler { } // namespace ash -#endif // ASH_WM_STICKY_KEYS_H_ +#endif // ASH_WM_STICKY_KEYS_CONTROLLER_H_ diff --git a/ash/wm/sticky_keys_unittest.cc b/ash/sticky_keys/sticky_keys_unittest.cc index 41c2238..de62289 100644 --- a/ash/wm/sticky_keys_unittest.cc +++ b/ash/sticky_keys/sticky_keys_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/wm/sticky_keys.h" +#include "ash/sticky_keys/sticky_keys_controller.h" #include <X11/Xlib.h> #undef None @@ -759,7 +759,7 @@ TEST_F(StickyKeysTest, KeyEventDispatchImpl) { aura::RootWindowHostDelegate* delegate = Shell::GetPrimaryRootWindow() ->GetDispatcher()->AsRootWindowHostDelegate(); Shell::GetInstance()->AddPreTargetHandler(&buffer); - Shell::GetInstance()->sticky_keys()->Enable(true); + Shell::GetInstance()->sticky_keys_controller()->Enable(true); SendActivateStickyKeyPattern(delegate, ui::VKEY_CONTROL); scoped_ptr<ui::KeyEvent> ev; @@ -798,7 +798,7 @@ TEST_F(StickyKeysTest, MouseEventDispatchImpl) { aura::RootWindowHostDelegate* delegate = Shell::GetPrimaryRootWindow() ->GetDispatcher()->AsRootWindowHostDelegate(); Shell::GetInstance()->AddPreTargetHandler(&buffer); - Shell::GetInstance()->sticky_keys()->Enable(true); + Shell::GetInstance()->sticky_keys_controller()->Enable(true); scoped_ptr<ui::MouseEvent> ev; SendActivateStickyKeyPattern(delegate, ui::VKEY_CONTROL); @@ -834,7 +834,7 @@ TEST_F(StickyKeysTest, MouseWheelEventDispatchImpl) { aura::RootWindowHostDelegate* delegate = Shell::GetPrimaryRootWindow() ->GetDispatcher()->AsRootWindowHostDelegate(); Shell::GetInstance()->AddPreTargetHandler(&buffer); - Shell::GetInstance()->sticky_keys()->Enable(true); + Shell::GetInstance()->sticky_keys_controller()->Enable(true); scoped_ptr<ui::MouseWheelEvent> ev; SendActivateStickyKeyPattern(delegate, ui::VKEY_CONTROL); |