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

Unified Diff: ash/accelerators/accelerator_controller.h

Issue 350943003: Support global keyboard commands on Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test updates Created 6 years, 5 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') | no next file with comments »
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 374286e50dd15b9c637cbfd84d5fe8d832aceddf..6b7ddb9ba1401ebefa23148352d4cde1c6699242 100644
--- a/ash/accelerators/accelerator_controller.h
+++ b/ash/accelerators/accelerator_controller.h
@@ -38,6 +38,21 @@ class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget {
AcceleratorController();
virtual ~AcceleratorController();
+ // A list of possible ways in which an accelerator should be restricted before
+ // processing. Any target registered with this controller should respect
+ // restrictions by calling |GetCurrentAcceleratorRestriction| during
+ // processing.
+ enum AcceleratorProcessingRestriction {
+ // Process the accelerator normally.
+ RESTRICTION_NONE,
+
+ // Don't process the accelerator.
+ RESTRICTION_PREVENT_PROCESSING,
+
+ // Don't process the accelerator and prevent propagation to other targets.
+ RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION
+ };
+
// Registers a global keyboard accelerator for the specified target. If
// multiple targets are registered for an accelerator, a target registered
// later has higher priority.
@@ -71,6 +86,9 @@ class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget {
bool PerformAction(int action,
const ui::Accelerator& accelerator);
+ // Returns the restriction for the current context.
+ AcceleratorProcessingRestriction GetCurrentAcceleratorRestriction();
+
// Overridden from ui::AcceleratorTarget:
virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
virtual bool CanHandleAccelerators() const OVERRIDE;
@@ -109,6 +127,11 @@ class ASH_EXPORT AcceleratorController : public ui::AcceleratorTarget {
void RegisterAccelerators(const AcceleratorData accelerators[],
size_t accelerators_length);
+ // Get the accelerator restriction for the given action. Supply an |action|
+ // of -1 to get restrictions that apply for the current context.
+ AcceleratorProcessingRestriction GetAcceleratorProcessingRestriction(
+ int action);
+
void SetKeyboardBrightnessControlDelegate(
scoped_ptr<KeyboardBrightnessControlDelegate>
keyboard_brightness_control_delegate);
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698