| 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 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/host/root_window_transformer.h" | 9 #include "ash/host/root_window_transformer.h" |
| 10 #include "ash/ime/input_method_event_handler.h" | 10 #include "ash/ime/input_method_event_handler.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_event_dispatcher.h" | 14 #include "ui/aura/window_event_dispatcher.h" |
| 15 #include "ui/aura/window_targeter.h" | 15 #include "ui/aura/window_targeter.h" |
| 16 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 17 #include "ui/gfx/geometry/insets.h" | 17 #include "ui/gfx/geometry/insets.h" |
| 18 #include "ui/gfx/native_widget_types.h" | |
| 19 #include "ui/platform_window/stub/stub_window.h" | 18 #include "ui/platform_window/stub/stub_window.h" |
| 20 | 19 |
| 21 namespace ash { | 20 namespace ash { |
| 22 | 21 |
| 23 class UnifiedEventTargeter : public aura::WindowTargeter { | 22 class UnifiedEventTargeter : public aura::WindowTargeter { |
| 24 public: | 23 public: |
| 25 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) | 24 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) |
| 26 : src_root_(src_root), dst_root_(dst_root) {} | 25 : src_root_(src_root), dst_root_(dst_root) {} |
| 27 | 26 |
| 28 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 27 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 | 43 |
| 45 aura::Window* src_root_; | 44 aura::Window* src_root_; |
| 46 aura::Window* dst_root_; | 45 aura::Window* dst_root_; |
| 47 | 46 |
| 48 DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter); | 47 DISALLOW_COPY_AND_ASSIGN(UnifiedEventTargeter); |
| 49 }; | 48 }; |
| 50 | 49 |
| 51 AshWindowTreeHostUnified::AshWindowTreeHostUnified( | 50 AshWindowTreeHostUnified::AshWindowTreeHostUnified( |
| 52 const gfx::Rect& initial_bounds) | 51 const gfx::Rect& initial_bounds) |
| 53 : AshWindowTreeHostPlatform() { | 52 : AshWindowTreeHostPlatform() { |
| 54 std::unique_ptr<ui::PlatformWindow> window( | 53 std::unique_ptr<ui::PlatformWindow> window(new ui::StubWindow(this)); |
| 55 new ui::StubWindow(this, gfx::kNullAcceleratedWidget)); | |
| 56 window->SetBounds(initial_bounds); | 54 window->SetBounds(initial_bounds); |
| 57 SetPlatformWindow(std::move(window)); | 55 SetPlatformWindow(std::move(window)); |
| 58 } | 56 } |
| 59 | 57 |
| 60 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { | 58 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { |
| 61 for (auto* ash_host : mirroring_hosts_) | 59 for (auto* ash_host : mirroring_hosts_) |
| 62 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); | 60 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); |
| 63 } | 61 } |
| 64 | 62 |
| 65 void AshWindowTreeHostUnified::PrepareForShutdown() { | 63 void AshWindowTreeHostUnified::PrepareForShutdown() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), | 103 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), |
| 106 [window](AshWindowTreeHost* ash_host) { | 104 [window](AshWindowTreeHost* ash_host) { |
| 107 return ash_host->AsWindowTreeHost()->window() == window; | 105 return ash_host->AsWindowTreeHost()->window() == window; |
| 108 }); | 106 }); |
| 109 DCHECK(iter != mirroring_hosts_.end()); | 107 DCHECK(iter != mirroring_hosts_.end()); |
| 110 window->RemoveObserver(this); | 108 window->RemoveObserver(this); |
| 111 mirroring_hosts_.erase(iter); | 109 mirroring_hosts_.erase(iter); |
| 112 } | 110 } |
| 113 | 111 |
| 114 } // namespace ash | 112 } // namespace ash |
| OLD | NEW |