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

Unified Diff: athena/input/accelerator_manager_impl.h

Issue 305873002: InputManager/AcceleratorManager for athena (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | « athena/input/DEPS ('k') | athena/input/accelerator_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/input/accelerator_manager_impl.h
diff --git a/athena/input/accelerator_manager_impl.h b/athena/input/accelerator_manager_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a5e8a95ebe7712bab082ec6184e36dc948aa73d
--- /dev/null
+++ b/athena/input/accelerator_manager_impl.h
@@ -0,0 +1,76 @@
+// Copyright 2014 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 ATHENA_INPUT_ACCELERATOR_MANAGER_H_
+#define ATHENA_INPUT_ACCELERATOR_MANAGER_H_
+
+#include "athena/input/public/accelerator_manager.h"
+
+#include <map>
+
+#include "base/macros.h"
+#include "ui/base/accelerators/accelerator.h"
+#include "ui/events/event_target_iterator.h"
+
+namespace aura {
+class Window;
+}
+
+namespace ui {
+class AcceleratorManager;
+}
+
+namespace wm {
+class AcceleratorFilter;
+class NestedAcceleratorController;
+}
+
+namespace athena {
+
+// AcceleratorManagerImpl provides a API to register accelerators
+// for athena modules. It hides various details on accelerator handling
+// such as how to handle accelerator in a nested loop, reserved accelerators
+// and repeated accelerators.
+class AcceleratorManagerImpl : public AcceleratorManager,
+ public ui::AcceleratorTarget {
+ public:
+ AcceleratorManagerImpl();
+ virtual ~AcceleratorManagerImpl();
+
+ void Init();
+
+ void OnRootWindowCreated(aura::Window* root_window);
+
+ bool IsReservedAccelerator(const ui::Accelerator& accelerator) const;
+ bool ProcessAccelerator(const ui::Accelerator& accelerator);
+
+ private:
+ // AcceleratorManager:
+ virtual void RegisterAccelerators(const AcceleratorData accelerators[],
+ size_t num_accelerators,
+ AcceleratorHandler* handler) OVERRIDE;
+ virtual void EnableDebugAccelerators() OVERRIDE;
+
+ // ui::AcceleratorTarget:
+ virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
+ virtual bool CanHandleAccelerators() const OVERRIDE;
+
+ class InternalData;
+
+ void RegisterAccelerator(const AcceleratorData& accelerator,
+ AcceleratorHandler* handler);
+
+ bool debug_accelerators_enabled_;
+ std::map<ui::Accelerator, InternalData> accelerators_;
+ scoped_ptr<ui::AcceleratorManager> accelerator_manager_;
+
+ scoped_ptr<wm::AcceleratorFilter> accelerator_filter_;
+ scoped_ptr<wm::NestedAcceleratorController> nested_accelerator_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(AcceleratorManagerImpl);
+};
+
+} // namespace athena
+
+#endif // ATHENA_INPUT_ACCELERATOR_MANAGER_H_
« no previous file with comments | « athena/input/DEPS ('k') | athena/input/accelerator_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698