| 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 "mash/wm/bridge/wm_root_window_controller_mus.h" | 5 #include "mash/wm/bridge/wm_root_window_controller_mus.h" |
| 6 | 6 |
| 7 #include "ash/wm/common/wm_root_window_controller_observer.h" | 7 #include "ash/wm/common/wm_root_window_controller_observer.h" |
| 8 #include "components/mus/public/cpp/window.h" | 8 #include "components/mus/public/cpp/window.h" |
| 9 #include "components/mus/public/cpp/window_property.h" | 9 #include "components/mus/public/cpp/window_property.h" |
| 10 #include "components/mus/public/cpp/window_tree_connection.h" | 10 #include "components/mus/public/cpp/window_tree_connection.h" |
| 11 #include "mash/wm/bridge/wm_globals_mus.h" | 11 #include "mash/wm/bridge/wm_globals_mus.h" |
| 12 #include "mash/wm/bridge/wm_window_mus.h" | 12 #include "mash/wm/bridge/wm_window_mus.h" |
| 13 #include "mash/wm/root_window_controller.h" | 13 #include "mash/wm/root_window_controller.h" |
| 14 #include "ui/display/display.h" | 14 #include "ui/display/display.h" |
| 15 #include "ui/views/mus/native_widget_mus.h" | 15 #include "ui/views/mus/native_widget_mus.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 MUS_DECLARE_WINDOW_PROPERTY_TYPE(mash::wm::WmRootWindowControllerMus*); | 18 MUS_DECLARE_WINDOW_PROPERTY_TYPE(mash::wm::WmRootWindowControllerMus*); |
| 19 | 19 |
| 20 namespace mash { | 20 namespace mash { |
| 21 namespace wm { | 21 namespace wm { |
| 22 | 22 |
| 23 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. | 23 MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(mash::wm::WmRootWindowControllerMus*, |
| 24 MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(mash::wm::WmRootWindowControllerMus, | |
| 25 kWmRootWindowControllerKey, | 24 kWmRootWindowControllerKey, |
| 26 nullptr); | 25 nullptr); |
| 27 | 26 |
| 28 WmRootWindowControllerMus::WmRootWindowControllerMus( | 27 WmRootWindowControllerMus::WmRootWindowControllerMus( |
| 29 WmGlobalsMus* globals, | 28 WmGlobalsMus* globals, |
| 30 RootWindowController* root_window_controller) | 29 RootWindowController* root_window_controller) |
| 31 : globals_(globals), root_window_controller_(root_window_controller) { | 30 : globals_(globals), root_window_controller_(root_window_controller) { |
| 32 globals_->AddRootWindowController(this); | 31 globals_->AddRootWindowController(this); |
| 33 root_window_controller_->root()->SetLocalProperty(kWmRootWindowControllerKey, | 32 root_window_controller_->root()->SetLocalProperty(kWmRootWindowControllerKey, |
| 34 this); | 33 this); |
| 35 } | 34 } |
| 36 | 35 |
| 37 WmRootWindowControllerMus::~WmRootWindowControllerMus() { | 36 WmRootWindowControllerMus::~WmRootWindowControllerMus() { |
| 38 globals_->RemoveRootWindowController(this); | 37 globals_->RemoveRootWindowController(this); |
| 39 } | 38 } |
| 40 | 39 |
| 41 // static | 40 // static |
| 42 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get( | 41 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get( |
| 43 const mus::Window* window) { | 42 const mus::Window* window) { |
| 44 if (!window) | 43 if (!window) |
| 45 return nullptr; | 44 return nullptr; |
| 46 | 45 |
| 47 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey); | 46 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey); |
| 48 } | 47 } |
| 49 | 48 |
| 49 void WmRootWindowControllerMus::NotifyFullscreenStateChange( |
| 50 bool is_fullscreen) { |
| 51 FOR_EACH_OBSERVER(ash::wm::WmRootWindowControllerObserver, observers_, |
| 52 OnFullscreenStateChanged(is_fullscreen)); |
| 53 } |
| 54 |
| 50 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen( | 55 gfx::Point WmRootWindowControllerMus::ConvertPointToScreen( |
| 51 const WmWindowMus* source, | 56 const WmWindowMus* source, |
| 52 const gfx::Point& point) const { | 57 const gfx::Point& point) const { |
| 53 gfx::Point point_in_root = | 58 gfx::Point point_in_root = |
| 54 source->ConvertPointToTarget(source->GetRootWindow(), point); | 59 source->ConvertPointToTarget(source->GetRootWindow(), point); |
| 55 point_in_root += GetDisplay().bounds().OffsetFromOrigin(); | 60 point_in_root += GetDisplay().bounds().OffsetFromOrigin(); |
| 56 return point_in_root; | 61 return point_in_root; |
| 57 } | 62 } |
| 58 | 63 |
| 59 gfx::Point WmRootWindowControllerMus::ConvertPointFromScreen( | 64 gfx::Point WmRootWindowControllerMus::ConvertPointFromScreen( |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 118 } |
| 114 | 119 |
| 115 ash::wm::WmWindow* WmRootWindowControllerMus::FindEventTarget( | 120 ash::wm::WmWindow* WmRootWindowControllerMus::FindEventTarget( |
| 116 const gfx::Point& location_in_screen) { | 121 const gfx::Point& location_in_screen) { |
| 117 NOTIMPLEMENTED(); | 122 NOTIMPLEMENTED(); |
| 118 return nullptr; | 123 return nullptr; |
| 119 } | 124 } |
| 120 | 125 |
| 121 void WmRootWindowControllerMus::AddObserver( | 126 void WmRootWindowControllerMus::AddObserver( |
| 122 ash::wm::WmRootWindowControllerObserver* observer) { | 127 ash::wm::WmRootWindowControllerObserver* observer) { |
| 123 NOTIMPLEMENTED(); | 128 observers_.AddObserver(observer); |
| 124 } | 129 } |
| 125 | 130 |
| 126 void WmRootWindowControllerMus::RemoveObserver( | 131 void WmRootWindowControllerMus::RemoveObserver( |
| 127 ash::wm::WmRootWindowControllerObserver* observer) { | 132 ash::wm::WmRootWindowControllerObserver* observer) { |
| 128 NOTIMPLEMENTED(); | 133 observers_.RemoveObserver(observer); |
| 129 } | 134 } |
| 130 | 135 |
| 131 } // namespace wm | 136 } // namespace wm |
| 132 } // namespace mash | 137 } // namespace mash |
| OLD | NEW |