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

Unified Diff: ash/accelerators/ash_menu_event_filter_delegate.h

Issue 1138523006: Enable keyboard accelerators while a menu is open (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed a bug in restoring the delegate of the parent nested runloop. Created 5 years, 4 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: ash/accelerators/ash_menu_event_filter_delegate.h
diff --git a/ash/accelerators/ash_menu_event_filter_delegate.h b/ash/accelerators/ash_menu_event_filter_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..781f655afedcfa340731900089c6b72daa636d5d
--- /dev/null
+++ b/ash/accelerators/ash_menu_event_filter_delegate.h
@@ -0,0 +1,37 @@
+// 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 ASH_ACCELERATORS_ASH_MENU_EVENT_FILTER_DELEGATE_H_
+#define ASH_ACCELERATORS_ASH_MENU_EVENT_FILTER_DELEGATE_H_
+
+#include "ui/views/controls/menu/menu_event_filter.h"
+
+namespace ui {
+class AcceleratorHistory;
+} // namespace ui
+
+namespace ash {
+
+// Defines an ash-specific implementation of the menu event filter delegate that
+// can handle the accelerators while a menu is present.
+class AshMenuEventFilterDelegate : public views::MenuEventFilter::Delegate {
+ public:
+ AshMenuEventFilterDelegate(ui::AcceleratorHistory* history);
+ ~AshMenuEventFilterDelegate() override;
+
+ // views::MenuEventFilter::Delegate:
+ void StoreInHistory(const ui::Accelerator& accelerator) override;
+ bool ShouldCloseMenuAndRepostAccelerator(
+ const ui::Accelerator& accelerator) const override;
+ void ProcessAcceleratorNow(const ui::Accelerator& accelerator) override;
+
+ private:
+ ui::AcceleratorHistory* accelerator_history_; // Not owned.
+
+ DISALLOW_COPY_AND_ASSIGN(AshMenuEventFilterDelegate);
+};
+
+} // namespace ash
+
+#endif // ASH_ACCELERATORS_ASH_MENU_EVENT_FILTER_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698