| 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 "ash/mus/bridge/wm_root_window_controller_mus.h" | 5 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 7 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
| 8 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 8 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
| 9 #include "ash/common/wm_root_window_controller_observer.h" | 9 #include "ash/common/wm_root_window_controller_observer.h" |
| 10 #include "ash/mus/bridge/wm_shelf_mus.h" | 10 #include "ash/mus/bridge/wm_shelf_mus.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 root_window_controller_->root()->SetLocalProperty(kWmRootWindowControllerKey, | 41 root_window_controller_->root()->SetLocalProperty(kWmRootWindowControllerKey, |
| 42 this); | 42 this); |
| 43 } | 43 } |
| 44 | 44 |
| 45 WmRootWindowControllerMus::~WmRootWindowControllerMus() { | 45 WmRootWindowControllerMus::~WmRootWindowControllerMus() { |
| 46 shell_->RemoveRootWindowController(this); | 46 shell_->RemoveRootWindowController(this); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get( | 50 const WmRootWindowControllerMus* WmRootWindowControllerMus::Get( |
| 51 const ::ui::Window* window) { | 51 const ui::Window* window) { |
| 52 if (!window) | 52 if (!window) |
| 53 return nullptr; | 53 return nullptr; |
| 54 | 54 |
| 55 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey); | 55 return window->GetRoot()->GetLocalProperty(kWmRootWindowControllerKey); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void WmRootWindowControllerMus::NotifyFullscreenStateChange( | 58 void WmRootWindowControllerMus::NotifyFullscreenStateChange( |
| 59 bool is_fullscreen) { | 59 bool is_fullscreen) { |
| 60 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, | 60 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, |
| 61 OnFullscreenStateChanged(is_fullscreen)); | 61 OnFullscreenStateChanged(is_fullscreen)); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 114 } |
| 115 | 115 |
| 116 void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer( | 116 void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer( |
| 117 views::Widget* widget, | 117 views::Widget* widget, |
| 118 int shell_container_id, | 118 int shell_container_id, |
| 119 views::Widget::InitParams* init_params) { | 119 views::Widget::InitParams* init_params) { |
| 120 init_params->parent_mus = WmWindowMus::GetMusWindow( | 120 init_params->parent_mus = WmWindowMus::GetMusWindow( |
| 121 WmWindowMus::Get(root_window_controller_->root()) | 121 WmWindowMus::Get(root_window_controller_->root()) |
| 122 ->GetChildByShellWindowId(shell_container_id)); | 122 ->GetChildByShellWindowId(shell_container_id)); |
| 123 DCHECK(init_params->parent_mus); | 123 DCHECK(init_params->parent_mus); |
| 124 ::ui::Window* new_window = | 124 ui::Window* new_window = |
| 125 root_window_controller_->root()->window_tree()->NewWindow(); | 125 root_window_controller_->root()->window_tree()->NewWindow(); |
| 126 WmWindowMus::Get(new_window) | 126 WmWindowMus::Get(new_window) |
| 127 ->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL); | 127 ->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL); |
| 128 init_params->native_widget = new views::NativeWidgetMus( | 128 init_params->native_widget = new views::NativeWidgetMus( |
| 129 widget, new_window, ::ui::mojom::SurfaceType::DEFAULT); | 129 widget, new_window, ui::mojom::SurfaceType::DEFAULT); |
| 130 } | 130 } |
| 131 | 131 |
| 132 WmWindow* WmRootWindowControllerMus::FindEventTarget( | 132 WmWindow* WmRootWindowControllerMus::FindEventTarget( |
| 133 const gfx::Point& location_in_screen) { | 133 const gfx::Point& location_in_screen) { |
| 134 NOTIMPLEMENTED(); | 134 NOTIMPLEMENTED(); |
| 135 return nullptr; | 135 return nullptr; |
| 136 } | 136 } |
| 137 | 137 |
| 138 gfx::Point WmRootWindowControllerMus::GetLastMouseLocationInRoot() { | 138 gfx::Point WmRootWindowControllerMus::GetLastMouseLocationInRoot() { |
| 139 gfx::Point location = root_window_controller_->window_manager() | 139 gfx::Point location = root_window_controller_->window_manager() |
| 140 ->window_tree_client() | 140 ->window_tree_client() |
| 141 ->GetCursorScreenPoint(); | 141 ->GetCursorScreenPoint(); |
| 142 location -= | 142 location -= |
| 143 root_window_controller_->display().bounds().origin().OffsetFromOrigin(); | 143 root_window_controller_->display().bounds().origin().OffsetFromOrigin(); |
| 144 return location; | 144 return location; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WmRootWindowControllerMus::AddObserver( | 147 void WmRootWindowControllerMus::AddObserver( |
| 148 WmRootWindowControllerObserver* observer) { | 148 WmRootWindowControllerObserver* observer) { |
| 149 observers_.AddObserver(observer); | 149 observers_.AddObserver(observer); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void WmRootWindowControllerMus::RemoveObserver( | 152 void WmRootWindowControllerMus::RemoveObserver( |
| 153 WmRootWindowControllerObserver* observer) { | 153 WmRootWindowControllerObserver* observer) { |
| 154 observers_.RemoveObserver(observer); | 154 observers_.RemoveObserver(observer); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace mus | 157 } // namespace mus |
| 158 } // namespace ash | 158 } // namespace ash |
| OLD | NEW |