OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/host/ash_window_tree_host_unified.h" | 5 #include "ash/host/ash_window_tree_host_unified.h" |
6 #include "ash/host/root_window_transformer.h" | 6 #include "ash/host/root_window_transformer.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
10 #include "ui/aura/window_targeter.h" | 10 #include "ui/aura/window_targeter.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 }; | 46 }; |
47 | 47 |
48 AshWindowTreeHostUnified::AshWindowTreeHostUnified( | 48 AshWindowTreeHostUnified::AshWindowTreeHostUnified( |
49 const gfx::Rect& initial_bounds) | 49 const gfx::Rect& initial_bounds) |
50 : bounds_(gfx::Rect(initial_bounds.size())), transformer_helper_(this) { | 50 : bounds_(gfx::Rect(initial_bounds.size())), transformer_helper_(this) { |
51 CreateCompositor(GetAcceleratedWidget()); | 51 CreateCompositor(GetAcceleratedWidget()); |
52 transformer_helper_.Init(); | 52 transformer_helper_.Init(); |
53 } | 53 } |
54 | 54 |
55 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { | 55 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { |
| 56 for (auto* ash_host : mirroring_hosts_) |
| 57 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); |
| 58 |
56 DestroyCompositor(); | 59 DestroyCompositor(); |
57 DestroyDispatcher(); | 60 DestroyDispatcher(); |
58 } | 61 } |
59 | 62 |
60 void AshWindowTreeHostUnified::PrepareForShutdown() { | 63 void AshWindowTreeHostUnified::PrepareForShutdown() { |
61 window()->SetEventTargeter( | 64 window()->SetEventTargeter( |
62 scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter)); | 65 scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter)); |
63 | 66 |
64 for (auto host : mirroring_hosts_) | 67 for (auto host : mirroring_hosts_) |
65 host->PrepareForShutdown(); | 68 host->PrepareForShutdown(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 DCHECK(iter != mirroring_hosts_.end()); | 179 DCHECK(iter != mirroring_hosts_.end()); |
177 window->RemoveObserver(this); | 180 window->RemoveObserver(this); |
178 mirroring_hosts_.erase(iter); | 181 mirroring_hosts_.erase(iter); |
179 } | 182 } |
180 | 183 |
181 ui::EventProcessor* AshWindowTreeHostUnified::GetEventProcessor() { | 184 ui::EventProcessor* AshWindowTreeHostUnified::GetEventProcessor() { |
182 return dispatcher(); | 185 return dispatcher(); |
183 } | 186 } |
184 | 187 |
185 } // namespace ash | 188 } // namespace ash |
OLD | NEW |