| 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 "ui/views/mus/window_tree_host_mus.h" | 5 #include "ui/views/mus/window_tree_host_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.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/events/event.h" | 10 #include "ui/events/event.h" |
| 11 #include "ui/views/mus/input_method_mus.h" | 11 #include "ui/views/mus/input_method_mus.h" |
| 12 #include "ui/views/mus/native_widget_mus.h" | 12 #include "ui/views/mus/native_widget_mus.h" |
| 13 #include "ui/views/mus/platform_window_mus.h" | 13 #include "ui/views/mus/platform_window_mus.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 18 // WindowTreeHostMus, public: | 18 // WindowTreeHostMus, public: |
| 19 | 19 |
| 20 WindowTreeHostMus::WindowTreeHostMus(shell::Connector* connector, | 20 WindowTreeHostMus::WindowTreeHostMus(shell::Connector* connector, |
| 21 NativeWidgetMus* native_widget, | 21 NativeWidgetMus* native_widget, |
| 22 mus::Window* window) | 22 mus::Window* window) |
| 23 : native_widget_(native_widget), | 23 : native_widget_(native_widget) { |
| 24 show_state_(ui::PLATFORM_WINDOW_STATE_UNKNOWN) { | |
| 25 SetPlatformWindow( | 24 SetPlatformWindow( |
| 26 base::WrapUnique(new PlatformWindowMus(this, connector, window))); | 25 base::WrapUnique(new PlatformWindowMus(this, connector, window))); |
| 27 // The location of events is already transformed, and there is no way to | 26 // The location of events is already transformed, and there is no way to |
| 28 // correctly determine the reverse transform. So, don't attempt to transform | 27 // correctly determine the reverse transform. So, don't attempt to transform |
| 29 // event locations, else the root location is wrong. | 28 // event locations, else the root location is wrong. |
| 30 // TODO(sky): we need to transform for device scale though. | 29 // TODO(sky): we need to transform for device scale though. |
| 31 dispatcher()->set_transform_events(false); | 30 dispatcher()->set_transform_events(false); |
| 32 compositor()->SetHostHasTransparentBackground(true); | 31 compositor()->SetHostHasTransparentBackground(true); |
| 33 | 32 |
| 34 input_method_.reset(new InputMethodMUS(this, window)); | 33 input_method_.reset(new InputMethodMUS(this, window)); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 52 return; | 51 return; |
| 53 } | 52 } |
| 54 WindowTreeHostPlatform::DispatchEvent(event); | 53 WindowTreeHostPlatform::DispatchEvent(event); |
| 55 } | 54 } |
| 56 | 55 |
| 57 void WindowTreeHostMus::OnClosed() { | 56 void WindowTreeHostMus::OnClosed() { |
| 58 if (native_widget_) | 57 if (native_widget_) |
| 59 native_widget_->OnPlatformWindowClosed(); | 58 native_widget_->OnPlatformWindowClosed(); |
| 60 } | 59 } |
| 61 | 60 |
| 62 void WindowTreeHostMus::OnWindowStateChanged(ui::PlatformWindowState state) { | |
| 63 show_state_ = state; | |
| 64 } | |
| 65 | |
| 66 void WindowTreeHostMus::OnActivationChanged(bool active) { | 61 void WindowTreeHostMus::OnActivationChanged(bool active) { |
| 67 if (active) | 62 if (active) |
| 68 GetInputMethod()->OnFocus(); | 63 GetInputMethod()->OnFocus(); |
| 69 else | 64 else |
| 70 GetInputMethod()->OnBlur(); | 65 GetInputMethod()->OnBlur(); |
| 71 if (native_widget_) | 66 if (native_widget_) |
| 72 native_widget_->OnActivationChanged(active); | 67 native_widget_->OnActivationChanged(active); |
| 73 WindowTreeHostPlatform::OnActivationChanged(active); | 68 WindowTreeHostPlatform::OnActivationChanged(active); |
| 74 } | 69 } |
| 75 | 70 |
| 76 void WindowTreeHostMus::OnCloseRequest() { | 71 void WindowTreeHostMus::OnCloseRequest() { |
| 77 OnHostCloseRequested(); | 72 OnHostCloseRequested(); |
| 78 } | 73 } |
| 79 | 74 |
| 80 } // namespace views | 75 } // namespace views |
| OLD | NEW |