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

Side by Side Diff: ash/accelerators/accelerator_dispatcher.h

Issue 182143002: Use the default dispatcher where possible for nested message loops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar-fix Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 5 #ifndef ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 6 #define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/message_loop/message_pump_dispatcher.h" 9 #include "base/message_loop/message_pump_dispatcher.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/aura/window_observer.h" 11 #include "ui/aura/window_observer.h"
12 12
13 namespace ash { 13 namespace ash {
14 14
15 // Dispatcher for handling accelerators from menu. 15 // Dispatcher for handling accelerators from menu.
16 // 16 //
17 // Wraps a nested dispatcher to which control is passed if no accelerator key 17 // Wraps a nested dispatcher to which control is passed if no accelerator key
18 // has been pressed. 18 // has been pressed. If the nested dispatcher is NULL, then the control is
19 // TODO(pkotwicz): Port AcceleratorDispatcher to mac. 19 // passed back to the default dispatcher.
20 // TODO(pkotwicz): Add support for a |nested_dispatcher| which sends 20 // TODO(pkotwicz): Add support for a |nested_dispatcher| which sends
21 // events to a system IME. 21 // events to a system IME.
22 class ASH_EXPORT AcceleratorDispatcher : public base::MessagePumpDispatcher, 22 class ASH_EXPORT AcceleratorDispatcher : public base::MessagePumpDispatcher,
23 public aura::WindowObserver { 23 public aura::WindowObserver {
24 public: 24 public:
25 AcceleratorDispatcher(base::MessagePumpDispatcher* nested_dispatcher, 25 AcceleratorDispatcher(base::MessagePumpDispatcher* nested_dispatcher,
26 aura::Window* associated_window); 26 aura::Window* associated_window);
27 virtual ~AcceleratorDispatcher(); 27 virtual ~AcceleratorDispatcher();
28 28
29 // MessagePumpDispatcher overrides: 29 // MessagePumpDispatcher overrides:
30 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; 30 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE;
31 31
32 // aura::WindowObserver overrides: 32 // aura::WindowObserver overrides:
33 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 33 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
34 34
35 private: 35 private:
36 base::MessagePumpDispatcher* nested_dispatcher_; 36 base::MessagePumpDispatcher* nested_dispatcher_;
37 37
38 // Window associated with |nested_dispatcher_| which is used to determine 38 // Window associated with |nested_dispatcher_| which is used to determine
39 // whether the |nested_dispatcher_| is allowed to receive events. 39 // whether the |nested_dispatcher_| is allowed to receive events.
40 aura::Window* associated_window_; 40 aura::Window* associated_window_;
41 41
42 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher); 42 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher);
43 }; 43 };
44 44
45 } // namespace ash 45 } // namespace ash
46 46
47 #endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 47 #endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698