| 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 "ash/ime/input_method_event_handler.h" | 7 #include "ash/ime/input_method_event_handler.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) | 21 UnifiedEventTargeter(aura::Window* src_root, aura::Window* dst_root) |
| 22 : src_root_(src_root), dst_root_(dst_root) {} | 22 : src_root_(src_root), dst_root_(dst_root) {} |
| 23 | 23 |
| 24 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, | 24 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, |
| 25 ui::Event* event) override { | 25 ui::Event* event) override { |
| 26 if (root == src_root_ && !event->target()) { | 26 if (root == src_root_ && !event->target()) { |
| 27 if (event->IsLocatedEvent()) { | 27 if (event->IsLocatedEvent()) { |
| 28 ui::LocatedEvent* located_event = static_cast<ui::LocatedEvent*>(event); | 28 ui::LocatedEvent* located_event = static_cast<ui::LocatedEvent*>(event); |
| 29 located_event->ConvertLocationToTarget( | 29 located_event->ConvertLocationToTarget( |
| 30 static_cast<aura::Window*>(nullptr), dst_root_); | 30 static_cast<aura::Window*>(nullptr), dst_root_); |
| 31 located_event->UpdateForRootTransform( | |
| 32 dst_root_->GetHost()->GetRootTransform()); | |
| 33 } | 31 } |
| 34 ignore_result( | 32 ignore_result( |
| 35 dst_root_->GetHost()->event_processor()->OnEventFromSource(event)); | 33 dst_root_->GetHost()->event_processor()->OnEventFromSource(event)); |
| 36 return nullptr; | 34 return nullptr; |
| 37 } else { | 35 } else { |
| 38 NOTREACHED() << "event type:" << event->type(); | 36 NOTREACHED() << "event type:" << event->type(); |
| 39 return aura::WindowTargeter::FindTargetForEvent(root, event); | 37 return aura::WindowTargeter::FindTargetForEvent(root, event); |
| 40 } | 38 } |
| 41 } | 39 } |
| 42 | 40 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 113 } |
| 116 | 114 |
| 117 void AshWindowTreeHostUnified::HideImpl() { | 115 void AshWindowTreeHostUnified::HideImpl() { |
| 118 } | 116 } |
| 119 | 117 |
| 120 gfx::Rect AshWindowTreeHostUnified::GetBounds() const { | 118 gfx::Rect AshWindowTreeHostUnified::GetBounds() const { |
| 121 return bounds_; | 119 return bounds_; |
| 122 } | 120 } |
| 123 | 121 |
| 124 void AshWindowTreeHostUnified::SetBounds(const gfx::Rect& bounds) { | 122 void AshWindowTreeHostUnified::SetBounds(const gfx::Rect& bounds) { |
| 125 if (bounds_.size() == bounds.size()) | |
| 126 return; | |
| 127 bounds_.set_size(bounds.size()); | 123 bounds_.set_size(bounds.size()); |
| 128 OnHostResized(bounds_.size()); | 124 OnHostResized(bounds_.size()); |
| 129 } | 125 } |
| 130 | 126 |
| 131 gfx::Transform AshWindowTreeHostUnified::GetRootTransform() const { | 127 gfx::Transform AshWindowTreeHostUnified::GetRootTransform() const { |
| 132 return transformer_helper_.GetTransform(); | 128 return transformer_helper_.GetTransform(); |
| 133 } | 129 } |
| 134 | 130 |
| 135 void AshWindowTreeHostUnified::SetRootTransform( | 131 void AshWindowTreeHostUnified::SetRootTransform( |
| 136 const gfx::Transform& transform) { | 132 const gfx::Transform& transform) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 155 gfx::Point AshWindowTreeHostUnified::GetLocationOnNativeScreen() const { | 151 gfx::Point AshWindowTreeHostUnified::GetLocationOnNativeScreen() const { |
| 156 return gfx::Point(); | 152 return gfx::Point(); |
| 157 } | 153 } |
| 158 | 154 |
| 159 void AshWindowTreeHostUnified::SetCursorNative(gfx::NativeCursor cursor) { | 155 void AshWindowTreeHostUnified::SetCursorNative(gfx::NativeCursor cursor) { |
| 160 for (auto host : mirroring_hosts_) | 156 for (auto host : mirroring_hosts_) |
| 161 host->AsWindowTreeHost()->SetCursor(cursor); | 157 host->AsWindowTreeHost()->SetCursor(cursor); |
| 162 } | 158 } |
| 163 | 159 |
| 164 void AshWindowTreeHostUnified::MoveCursorToNative(const gfx::Point& location) { | 160 void AshWindowTreeHostUnified::MoveCursorToNative(const gfx::Point& location) { |
| 165 // TODO(oshima): Find out if this is neceessary. | 161 // No native cursor in offscreen surface. |
| 166 NOTIMPLEMENTED(); | |
| 167 } | 162 } |
| 168 | 163 |
| 169 void AshWindowTreeHostUnified::OnCursorVisibilityChangedNative(bool show) { | 164 void AshWindowTreeHostUnified::OnCursorVisibilityChangedNative(bool show) { |
| 170 for (auto host : mirroring_hosts_) | 165 for (auto host : mirroring_hosts_) |
| 171 host->AsWindowTreeHost()->OnCursorVisibilityChanged(show); | 166 host->AsWindowTreeHost()->OnCursorVisibilityChanged(show); |
| 172 } | 167 } |
| 173 | 168 |
| 174 void AshWindowTreeHostUnified::OnWindowDestroying(aura::Window* window) { | 169 void AshWindowTreeHostUnified::OnWindowDestroying(aura::Window* window) { |
| 175 auto iter = | 170 auto iter = |
| 176 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), | 171 std::find_if(mirroring_hosts_.begin(), mirroring_hosts_.end(), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 188 input_method_handler()->SetPostIME(true); | 183 input_method_handler()->SetPostIME(true); |
| 189 ui::EventDispatchDetails details = | 184 ui::EventDispatchDetails details = |
| 190 event_processor()->OnEventFromSource(&event_copy); | 185 event_processor()->OnEventFromSource(&event_copy); |
| 191 if (details.dispatcher_destroyed) | 186 if (details.dispatcher_destroyed) |
| 192 return true; | 187 return true; |
| 193 input_method_handler()->SetPostIME(false); | 188 input_method_handler()->SetPostIME(false); |
| 194 return event_copy.stopped_propagation(); | 189 return event_copy.stopped_propagation(); |
| 195 } | 190 } |
| 196 | 191 |
| 197 } // namespace ash | 192 } // namespace ash |
| OLD | NEW |