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

Unified Diff: ui/base/accelerators/accelerator_processor.h

Issue 838253004: MacViews: Fix duplicate definition of ExtensionKeyBindingRegistry::SetShortcutHandlingSuspended (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DragBookmarks2
Patch Set: Created 5 years, 11 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
Index: ui/base/accelerators/accelerator_processor.h
diff --git a/ui/base/accelerators/accelerator_processor.h b/ui/base/accelerators/accelerator_processor.h
new file mode 100644
index 0000000000000000000000000000000000000000..f9eff32e6bd25de24511fbea0a1a44e930f0529e
--- /dev/null
+++ b/ui/base/accelerators/accelerator_processor.h
@@ -0,0 +1,38 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_BASE_ACCELERATORS_ACCELERATOR_PROCESSOR_H_
+#define UI_BASE_ACCELERATORS_ACCELERATOR_PROCESSOR_H_
+
+#include "ui/base/ui_base_export.h"
+
+namespace ui {
+
+class Accelerator;
+class AcceleratorTarget;
+
+// An interface for dispatching accelerators to AcceleratorTargets.
+class UI_BASE_EXPORT AcceleratorProcessor {
+ public:
+ // Activate the target associated with the specified accelerator.
+ // First, AcceleratorPressed handler of the most recently registered target
+ // is called, and if that handler processes the event (i.e. returns true),
+ // this method immediately returns. If not, we do the same thing on the next
+ // target, and so on.
+ // Returns true if an accelerator was activated.
+ virtual bool ProcessAccelerator(const Accelerator& accelerator) = 0;
+
+ // Returns the AcceleratorTarget that should be activated for the specified
+ // keyboard accelerator, or NULL if no target is registered for that keyboard
+ // accelerator.
+ virtual AcceleratorTarget* GetTargetForAccelerator(
+ const Accelerator& accelerator) const = 0;
+
+ protected:
+ virtual ~AcceleratorProcessor() {}
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ACCELERATORS_ACCELERATOR_PROCESSOR_H_

Powered by Google App Engine
This is Rietveld 408576698