OLD | NEW |
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 #include "ash/accelerators/accelerator_dispatcher.h" | 5 #include "ash/accelerators/accelerator_dispatcher.h" |
6 | 6 |
7 namespace ash { | 7 namespace ash { |
8 | 8 |
9 AcceleratorDispatcher::AcceleratorDispatcher( | 9 AcceleratorDispatcher::AcceleratorDispatcher( |
10 MessageLoop::Dispatcher* nested_dispatcher, aura::Window* associated_window) | 10 MessageLoop::Dispatcher* nested_dispatcher, aura::Window* associated_window) |
11 : nested_dispatcher_(nested_dispatcher), | 11 : nested_dispatcher_(nested_dispatcher), |
12 associated_window_(associated_window) { | 12 associated_window_(associated_window) { |
13 DCHECK(nested_dispatcher_); | 13 DCHECK(nested_dispatcher_); |
14 DCHECK(associated_window_); | 14 associated_window_->AddObserver(this); |
| 15 } |
| 16 |
| 17 AcceleratorDispatcher::~AcceleratorDispatcher() { |
| 18 if (associated_window_) |
| 19 associated_window_->RemoveObserver(this); |
| 20 } |
| 21 |
| 22 void AcceleratorDispatcher::OnWindowDestroying(aura::Window* window) { |
| 23 if (associated_window_ == window) |
| 24 associated_window_ = NULL; |
15 } | 25 } |
16 | 26 |
17 } // namespace ash | 27 } // namespace ash |
OLD | NEW |