| 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" |
| 11 #include "ui/compositor/compositor.h" | 11 #include "ui/compositor/compositor.h" |
| 12 #include "ui/events/event_processor.h" | 12 #include "ui/events/event_processor.h" |
| 13 #include "ui/events/null_event_targeter.h" |
| 13 #include "ui/gfx/geometry/insets.h" | 14 #include "ui/gfx/geometry/insets.h" |
| 14 | 15 |
| 15 namespace ash { | 16 namespace ash { |
| 16 | 17 |
| 17 class UnifiedEventTargeter : public aura::WindowTargeter { | 18 class UnifiedEventTargeter : public aura::WindowTargeter { |
| 18 public: | 19 public: |
| 19 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) | 20 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) |
| 20 : src_root_(src_root), dst_root_(dst_root) {} | 21 : src_root_(src_root), dst_root_(dst_root) {} |
| 21 | 22 |
| 22 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 23 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 : bounds_(gfx::Rect(initial_bounds.size())) { | 50 : bounds_(gfx::Rect(initial_bounds.size())) { |
| 50 CreateCompositor(GetAcceleratedWidget()); | 51 CreateCompositor(GetAcceleratedWidget()); |
| 51 } | 52 } |
| 52 | 53 |
| 53 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { | 54 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { |
| 54 DestroyCompositor(); | 55 DestroyCompositor(); |
| 55 DestroyDispatcher(); | 56 DestroyDispatcher(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void AshWindowTreeHostUnified::PrepareForShutdown() { | 59 void AshWindowTreeHostUnified::PrepareForShutdown() { |
| 60 window()->SetEventTargeter( |
| 61 scoped_ptr<ui::EventTargeter>(new ui::NullEventTargeter)); |
| 62 |
| 59 for (auto host : mirroring_hosts_) | 63 for (auto host : mirroring_hosts_) |
| 60 host->PrepareForShutdown(); | 64 host->PrepareForShutdown(); |
| 61 } | 65 } |
| 62 | 66 |
| 63 void AshWindowTreeHostUnified::RegisterMirroringHost( | 67 void AshWindowTreeHostUnified::RegisterMirroringHost( |
| 64 AshWindowTreeHost* mirroring_ash_host) { | 68 AshWindowTreeHost* mirroring_ash_host) { |
| 65 aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); | 69 aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); |
| 66 src_root->SetEventTargeter( | 70 src_root->SetEventTargeter( |
| 67 make_scoped_ptr(new UnifiedEventTargeter(src_root, window()))); | 71 make_scoped_ptr(new UnifiedEventTargeter(src_root, window()))); |
| 68 DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), | 72 DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 DCHECK(iter != mirroring_hosts_.end()); | 159 DCHECK(iter != mirroring_hosts_.end()); |
| 156 window->RemoveObserver(this); | 160 window->RemoveObserver(this); |
| 157 mirroring_hosts_.erase(iter); | 161 mirroring_hosts_.erase(iter); |
| 158 } | 162 } |
| 159 | 163 |
| 160 ui::EventProcessor* AshWindowTreeHostUnified::GetEventProcessor() { | 164 ui::EventProcessor* AshWindowTreeHostUnified::GetEventProcessor() { |
| 161 return dispatcher(); | 165 return dispatcher(); |
| 162 } | 166 } |
| 163 | 167 |
| 164 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |