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

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

Issue 9348113: Fix two crash and potential leak&crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert unnecessary file, updated comment Created 8 years, 10 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 #pragma once 7 #pragma once
8 8
9 #include "ash/ash_export.h" 9 #include "ash/ash_export.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
12 #include "ui/aura/window_observer.h"
12 13
13 namespace ash { 14 namespace ash {
14 15
15 // Dispatcher for handling accelerators in ash. 16 // Dispatcher for handling accelerators in ash.
16 // 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
17 // has been pressed. 18 // has been pressed.
18 // TODO(pkotwicz): Port AcceleratorDispatcher to mac. 19 // TODO(pkotwicz): Port AcceleratorDispatcher to mac.
19 class ASH_EXPORT AcceleratorDispatcher : public MessageLoop::Dispatcher { 20 class ASH_EXPORT AcceleratorDispatcher : public MessageLoop::Dispatcher,
21 public aura::WindowObserver {
20 public: 22 public:
21 explicit AcceleratorDispatcher(MessageLoop::Dispatcher* nested_dispatcher, 23 explicit AcceleratorDispatcher(MessageLoop::Dispatcher* nested_dispatcher,
22 aura::Window* associated_window); 24 aura::Window* associated_window);
25 virtual ~AcceleratorDispatcher();
23 26
24 #if defined(USE_X11) 27 #if defined(USE_X11)
25 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( 28 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch(
26 XEvent* xev) OVERRIDE; 29 XEvent* xev) OVERRIDE;
27 #elif defined(OS_WIN) 30 #elif defined(OS_WIN)
28 bool AcceleratorDispatcher::Dispatch(const MSG& msg) OVERRIDE; 31 bool AcceleratorDispatcher::Dispatch(const MSG& msg) OVERRIDE;
29 #endif 32 #endif
30 33
34 // aura::WindowObserver overrides:
35 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
36
31 private: 37 private:
32 MessageLoop::Dispatcher* nested_dispatcher_; 38 MessageLoop::Dispatcher* nested_dispatcher_;
33 39
34 // Window associated with |nested_dispatcher_| which is used to determine 40 // Window associated with |nested_dispatcher_| which is used to determine
35 // whether the |nested_dispatcher_| is allowed to receive events. 41 // whether the |nested_dispatcher_| is allowed to receive events.
36 aura::Window* associated_window_; 42 aura::Window* associated_window_;
37 43
38 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher); 44 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher);
39 }; 45 };
40 46
41 } // namespace ash 47 } // namespace ash
42 48
43 #endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 49 #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