OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/mus/ash_window_tree_host_mus.h" |
| 6 |
| 7 #include "ash/host/root_window_transformer.h" |
| 8 #include "ash/host/transformer_helper.h" |
| 9 #include "base/memory/ptr_util.h" |
| 10 #include "ui/aura/mus/window_tree_host_mus_init_params.h" |
| 11 #include "ui/aura/window.h" |
| 12 #include "ui/events/null_event_targeter.h" |
| 13 |
| 14 namespace ash { |
| 15 |
| 16 AshWindowTreeHostMus::AshWindowTreeHostMus( |
| 17 aura::WindowTreeHostMusInitParams init_params) |
| 18 : aura::WindowTreeHostMus(std::move(init_params)), |
| 19 transformer_helper_(base::MakeUnique<TransformerHelper>(this)) { |
| 20 transformer_helper_->Init(); |
| 21 } |
| 22 |
| 23 AshWindowTreeHostMus::~AshWindowTreeHostMus() {} |
| 24 |
| 25 void AshWindowTreeHostMus::ToggleFullScreen() { |
| 26 NOTIMPLEMENTED(); |
| 27 } |
| 28 |
| 29 bool AshWindowTreeHostMus::ConfineCursorToRootWindow() { |
| 30 // TODO: when implementing see implementation in AshWindowTreeHostPlatform |
| 31 // for how it uses |transformer_helper_|. |
| 32 NOTIMPLEMENTED(); |
| 33 return true; |
| 34 } |
| 35 |
| 36 void AshWindowTreeHostMus::UnConfineCursor() { |
| 37 NOTIMPLEMENTED(); |
| 38 } |
| 39 |
| 40 void AshWindowTreeHostMus::SetRootWindowTransformer( |
| 41 std::unique_ptr<RootWindowTransformer> transformer) { |
| 42 transformer_helper_->SetRootWindowTransformer(std::move(transformer)); |
| 43 ConfineCursorToRootWindow(); |
| 44 } |
| 45 |
| 46 gfx::Insets AshWindowTreeHostMus::GetHostInsets() const { |
| 47 return transformer_helper_->GetHostInsets(); |
| 48 } |
| 49 |
| 50 aura::WindowTreeHost* AshWindowTreeHostMus::AsWindowTreeHost() { |
| 51 return this; |
| 52 } |
| 53 |
| 54 void AshWindowTreeHostMus::PrepareForShutdown() { |
| 55 // WindowEventDispatcher may have pending events that need to be processed. |
| 56 // At the time this function is called the WindowTreeHost and Window are in |
| 57 // a semi-shutdown state. Reset the targeter so that the current targeter |
| 58 // doesn't attempt to process events while in this state, which would likely |
| 59 // crash. |
| 60 std::unique_ptr<ui::NullEventTargeter> null_event_targeter = |
| 61 base::MakeUnique<ui::NullEventTargeter>(); |
| 62 window()->SetEventTargeter(std::move(null_event_targeter)); |
| 63 } |
| 64 |
| 65 void AshWindowTreeHostMus::RegisterMirroringHost( |
| 66 AshWindowTreeHost* mirroring_ash_host) { |
| 67 NOTIMPLEMENTED(); |
| 68 } |
| 69 |
| 70 void AshWindowTreeHostMus::SetRootTransform(const gfx::Transform& transform) { |
| 71 transformer_helper_->SetTransform(transform); |
| 72 } |
| 73 |
| 74 gfx::Transform AshWindowTreeHostMus::GetRootTransform() const { |
| 75 return transformer_helper_->GetTransform(); |
| 76 } |
| 77 |
| 78 gfx::Transform AshWindowTreeHostMus::GetInverseRootTransform() const { |
| 79 return transformer_helper_->GetInverseTransform(); |
| 80 } |
| 81 |
| 82 void AshWindowTreeHostMus::UpdateRootWindowSizeInPixels( |
| 83 const gfx::Size& host_size_in_pixels) { |
| 84 transformer_helper_->UpdateWindowSize(host_size_in_pixels); |
| 85 } |
| 86 |
| 87 } // namespace ash |
OLD | NEW |