1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
8 #include "ash/ash_export.h"
9 #include "base/message_loop.h"
10 #include "ui/aura/window.h"
11 #include "ui/aura/window_observer.h"
15 // Dispatcher for handling accelerators from menu.
17 // Wraps a nested dispatcher to which control is passed if no accelerator key
19 // TODO(pkotwicz): Port AcceleratorDispatcher to mac.
20 // TODO(pkotwicz): Add support for a |nested_dispatcher| which sends
21 // events to a system IME.
22 class ASH_EXPORT AcceleratorDispatcher
: public base::MessageLoop::Dispatcher
,
23 public aura::WindowObserver
{
25 AcceleratorDispatcher(base::MessageLoop::Dispatcher
* nested_dispatcher
,
26 aura::Window
* associated_window
);
27 virtual ~AcceleratorDispatcher();
29 // MessageLoop::Dispatcher overrides:
30 virtual bool Dispatch(const base::NativeEvent
& event
) OVERRIDE
;
32 // aura::WindowObserver overrides:
33 virtual void OnWindowDestroying(aura::Window
* window
) OVERRIDE
;
36 base::MessageLoop::Dispatcher
* nested_dispatcher_
;
38 // Window associated with |nested_dispatcher_| which is used to determine
39 // whether the |nested_dispatcher_| is allowed to receive events.
40 aura::Window
* associated_window_
;
42 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher
);
47 #endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_