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

Unified Diff: ash/accelerators/accelerator_controller.h

Issue 308023002: Add EF_IS_REPEAT flag to KeyEvent to handle repeated accelerators correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller.cc » ('j') | ui/events/event.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.h
diff --git a/ash/accelerators/accelerator_controller.h b/ash/accelerators/accelerator_controller.h
index ee4ddfc00c6d06b56a20543774d1d263d9131507..1e3a42e99473fcf94e0da587c060409c943e49b4 100644
--- a/ash/accelerators/accelerator_controller.h
+++ b/ash/accelerators/accelerator_controller.h
@@ -30,33 +30,6 @@ class KeyboardBrightnessControlDelegate;
class ScreenshotDelegate;
class VolumeControlDelegate;
-// Stores information about accelerator context, eg. previous accelerator
-// or if the current accelerator is repeated or not.
-class ASH_EXPORT AcceleratorControllerContext {
- public:
- AcceleratorControllerContext();
- ~AcceleratorControllerContext() {}
-
- // Updates context - determines if the accelerator is repeated, as well as
- // event type of the previous accelerator.
- void UpdateContext(const ui::Accelerator& accelerator);
-
- const ui::Accelerator& previous_accelerator() const {
- return previous_accelerator_;
- }
- bool repeated() const {
- return current_accelerator_ == previous_accelerator_ &&
- current_accelerator_.type() != ui::ET_UNKNOWN;
- }
-
- private:
- ui::Accelerator current_accelerator_;
- // Used for NEXT_IME and DISABLE_CAPS_LOCK accelerator actions.
- ui::Accelerator previous_accelerator_;
-
- DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerContext);
-};
-
// AcceleratorController provides functions for registering or unregistering
// global keyboard accelerators, which are handled earlier than any windows. It
// also implements several handlers as an accelerator target.
@@ -115,16 +88,15 @@ class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget {
return screenshot_delegate_.get();
}
- // Provides access to an object holding contextual information.
- AcceleratorControllerContext* context() {
- return &context_;
- }
-
// Provides access to the ExitWarningHandler for testing.
ExitWarningHandler* GetExitWarningHandlerForTest() {
return &exit_warning_handler_;
}
+ const ui::Accelerator& previous_accelerator_for_test() const {
+ return previous_accelerator_;
+ }
+
private:
FRIEND_TEST_ALL_PREFIXES(AcceleratorControllerTest, GlobalAccelerators);
@@ -149,8 +121,9 @@ class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget {
keyboard_brightness_control_delegate_;
scoped_ptr<ScreenshotDelegate> screenshot_delegate_;
- // Contextual information, eg. if the current accelerator is repeated.
- AcceleratorControllerContext context_;
+ // Remember previous accelerator as some accelerator needs to be fired
+ // with a specific sequence.
+ ui::Accelerator previous_accelerator_;
// Handles the exit accelerator which requires a double press to exit and
// shows a popup with an explanation.
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller.cc » ('j') | ui/events/event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698