OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/desktop_window_tree_host_mus.h" | 5 #include "ui/views/mus/desktop_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/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/client/cursor_client.h" | 9 #include "ui/aura/client/cursor_client.h" |
10 #include "ui/aura/client/drag_drop_client.h" | 10 #include "ui/aura/client/drag_drop_client.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 DesktopNativeWidgetAura* desktop_native_widget_aura, | 173 DesktopNativeWidgetAura* desktop_native_widget_aura, |
174 const std::map<std::string, std::vector<uint8_t>>* mus_properties) | 174 const std::map<std::string, std::vector<uint8_t>>* mus_properties) |
175 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(), | 175 : aura::WindowTreeHostMus(MusClient::Get()->window_tree_client(), |
176 mus_properties), | 176 mus_properties), |
177 native_widget_delegate_(native_widget_delegate), | 177 native_widget_delegate_(native_widget_delegate), |
178 desktop_native_widget_aura_(desktop_native_widget_aura), | 178 desktop_native_widget_aura_(desktop_native_widget_aura), |
179 fullscreen_restore_state_(ui::SHOW_STATE_DEFAULT), | 179 fullscreen_restore_state_(ui::SHOW_STATE_DEFAULT), |
180 close_widget_factory_(this) { | 180 close_widget_factory_(this) { |
181 aura::Env::GetInstance()->AddObserver(this); | 181 aura::Env::GetInstance()->AddObserver(this); |
182 MusClient::Get()->AddObserver(this); | 182 MusClient::Get()->AddObserver(this); |
| 183 // DesktopNativeWidgetAura registers the association between |content_window_| |
| 184 // and Widget, but code may also want to go from the root (window()) to the |
| 185 // Widget. This call enables that. |
| 186 NativeWidgetAura::RegisterNativeWidgetForWindow(desktop_native_widget_aura, |
| 187 window()); |
183 // TODO: use display id and bounds if available, likely need to pass in | 188 // TODO: use display id and bounds if available, likely need to pass in |
184 // InitParams for that. | 189 // InitParams for that. |
185 } | 190 } |
186 | 191 |
187 DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() { | 192 DesktopWindowTreeHostMus::~DesktopWindowTreeHostMus() { |
188 MusClient::Get()->RemoveObserver(this); | 193 MusClient::Get()->RemoveObserver(this); |
189 aura::Env::GetInstance()->RemoveObserver(this); | 194 aura::Env::GetInstance()->RemoveObserver(this); |
190 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); | 195 desktop_native_widget_aura_->OnDesktopWindowTreeHostDestroyed(this); |
191 } | 196 } |
192 | 197 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 if (window == this->window()) { | 708 if (window == this->window()) { |
704 is_active_ = true; | 709 is_active_ = true; |
705 desktop_native_widget_aura_->HandleActivationChanged(true); | 710 desktop_native_widget_aura_->HandleActivationChanged(true); |
706 } else if (is_active_) { | 711 } else if (is_active_) { |
707 is_active_ = false; | 712 is_active_ = false; |
708 desktop_native_widget_aura_->HandleActivationChanged(false); | 713 desktop_native_widget_aura_->HandleActivationChanged(false); |
709 } | 714 } |
710 } | 715 } |
711 | 716 |
712 } // namespace views | 717 } // namespace views |
OLD | NEW |