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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { | 58 AshWindowTreeHostUnified::~AshWindowTreeHostUnified() { |
59 for (auto* ash_host : mirroring_hosts_) | 59 for (auto* ash_host : mirroring_hosts_) |
60 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); | 60 ash_host->AsWindowTreeHost()->window()->RemoveObserver(this); |
61 } | 61 } |
62 | 62 |
63 void AshWindowTreeHostUnified::PrepareForShutdown() { | 63 void AshWindowTreeHostUnified::PrepareForShutdown() { |
64 AshWindowTreeHostPlatform::PrepareForShutdown(); | 64 AshWindowTreeHostPlatform::PrepareForShutdown(); |
65 | 65 |
66 for (auto host : mirroring_hosts_) | 66 for (auto* host : mirroring_hosts_) |
67 host->PrepareForShutdown(); | 67 host->PrepareForShutdown(); |
68 } | 68 } |
69 | 69 |
70 void AshWindowTreeHostUnified::RegisterMirroringHost( | 70 void AshWindowTreeHostUnified::RegisterMirroringHost( |
71 AshWindowTreeHost* mirroring_ash_host) { | 71 AshWindowTreeHost* mirroring_ash_host) { |
72 aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); | 72 aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); |
73 src_root->SetEventTargeter( | 73 src_root->SetEventTargeter( |
74 base::WrapUnique(new UnifiedEventTargeter(src_root, window()))); | 74 base::WrapUnique(new UnifiedEventTargeter(src_root, window()))); |
75 DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), | 75 DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), |
76 mirroring_ash_host) == mirroring_hosts_.end()); | 76 mirroring_ash_host) == mirroring_hosts_.end()); |
77 mirroring_hosts_.push_back(mirroring_ash_host); | 77 mirroring_hosts_.push_back(mirroring_ash_host); |
78 mirroring_ash_host->AsWindowTreeHost()->window()->AddObserver(this); | 78 mirroring_ash_host->AsWindowTreeHost()->window()->AddObserver(this); |
79 } | 79 } |
80 | 80 |
81 void AshWindowTreeHostUnified::SetBounds(const gfx::Rect& bounds) { | 81 void AshWindowTreeHostUnified::SetBounds(const gfx::Rect& bounds) { |
82 AshWindowTreeHostPlatform::SetBounds(bounds); | 82 AshWindowTreeHostPlatform::SetBounds(bounds); |
83 OnHostResized(bounds.size()); | 83 OnHostResized(bounds.size()); |
84 } | 84 } |
85 | 85 |
86 void AshWindowTreeHostUnified::SetCursorNative(gfx::NativeCursor cursor) { | 86 void AshWindowTreeHostUnified::SetCursorNative(gfx::NativeCursor cursor) { |
87 for (auto host : mirroring_hosts_) | 87 for (auto* host : mirroring_hosts_) |
88 host->AsWindowTreeHost()->SetCursor(cursor); | 88 host->AsWindowTreeHost()->SetCursor(cursor); |
89 } | 89 } |
90 | 90 |
91 void AshWindowTreeHostUnified::OnCursorVisibilityChangedNative(bool show) { | 91 void AshWindowTreeHostUnified::OnCursorVisibilityChangedNative(bool show) { |
92 for (auto host : mirroring_hosts_) | 92 for (auto* host : mirroring_hosts_) |
93 host->AsWindowTreeHost()->OnCursorVisibilityChanged(show); | 93 host->AsWindowTreeHost()->OnCursorVisibilityChanged(show); |
94 } | 94 } |
95 | 95 |
96 void AshWindowTreeHostUnified::OnBoundsChanged(const gfx::Rect& bounds) { | 96 void AshWindowTreeHostUnified::OnBoundsChanged(const gfx::Rect& bounds) { |
97 if (platform_window()) | 97 if (platform_window()) |
98 OnHostResized(bounds.size()); | 98 OnHostResized(bounds.size()); |
99 } | 99 } |
100 | 100 |
101 void AshWindowTreeHostUnified::OnWindowDestroying(aura::Window* window) { | 101 void AshWindowTreeHostUnified::OnWindowDestroying(aura::Window* window) { |
102 auto iter = | 102 auto iter = |
103 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), | 103 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), |
104 [window](AshWindowTreeHost* ash_host) { | 104 [window](AshWindowTreeHost* ash_host) { |
105 return ash_host->AsWindowTreeHost()->window() == window; | 105 return ash_host->AsWindowTreeHost()->window() == window; |
106 }); | 106 }); |
107 DCHECK(iter != mirroring_hosts_.end()); | 107 DCHECK(iter != mirroring_hosts_.end()); |
108 window->RemoveObserver(this); | 108 window->RemoveObserver(this); |
109 mirroring_hosts_.erase(iter); | 109 mirroring_hosts_.erase(iter); |
110 } | 110 } |
111 | 111 |
112 } // namespace ash | 112 } // namespace ash |
OLD | NEW |