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 "ash/mus/non_client_frame_controller.h" | 5 #include "ash/mus/non_client_frame_controller.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void UpdateWindowTitle() override {} | 105 void UpdateWindowTitle() override {} |
106 void SizeConstraintsChanged() override {} | 106 void SizeConstraintsChanged() override {} |
107 | 107 |
108 private: | 108 private: |
109 DISALLOW_COPY_AND_ASSIGN(EmptyDraggableNonClientFrameView); | 109 DISALLOW_COPY_AND_ASSIGN(EmptyDraggableNonClientFrameView); |
110 }; | 110 }; |
111 | 111 |
112 class WmNativeWidgetMus : public views::NativeWidgetMus { | 112 class WmNativeWidgetMus : public views::NativeWidgetMus { |
113 public: | 113 public: |
114 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, | 114 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, |
| 115 shell::Connector* connector, |
115 ui::Window* window, | 116 ui::Window* window, |
116 ui::WindowManagerClient* window_manager_client) | 117 ui::WindowManagerClient* window_manager_client) |
117 : NativeWidgetMus(delegate, window, ui::mojom::SurfaceType::UNDERLAY), | 118 : NativeWidgetMus(delegate, |
| 119 connector, |
| 120 window, |
| 121 ui::mojom::SurfaceType::UNDERLAY), |
118 window_manager_client_(window_manager_client) {} | 122 window_manager_client_(window_manager_client) {} |
119 ~WmNativeWidgetMus() override {} | 123 ~WmNativeWidgetMus() override {} |
120 | 124 |
121 // NativeWidgetMus: | 125 // NativeWidgetMus: |
122 views::NonClientFrameView* CreateNonClientFrameView() override { | 126 views::NonClientFrameView* CreateNonClientFrameView() override { |
123 move_event_handler_.reset(new MoveEventHandler( | 127 move_event_handler_.reset(new MoveEventHandler( |
124 window(), window_manager_client_, GetNativeView())); | 128 window(), window_manager_client_, GetNativeView())); |
125 if (ShouldRemoveStandardFrame(window())) | 129 if (ShouldRemoveStandardFrame(window())) |
126 return new EmptyDraggableNonClientFrameView(); | 130 return new EmptyDraggableNonClientFrameView(); |
127 return new NonClientFrameViewMash(GetWidget(), window()); | 131 return new NonClientFrameViewMash(GetWidget(), window()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 231 |
228 // To simplify things this code creates a Widget. While a Widget is created | 232 // To simplify things this code creates a Widget. While a Widget is created |
229 // we need to ensure we don't inadvertently change random properties of the | 233 // we need to ensure we don't inadvertently change random properties of the |
230 // underlying ui::Window. For example, showing the Widget shouldn't change | 234 // underlying ui::Window. For example, showing the Widget shouldn't change |
231 // the bounds of the ui::Window in anyway. | 235 // the bounds of the ui::Window in anyway. |
232 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 236 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
233 // We initiate focus at the mus level, not at the views level. | 237 // We initiate focus at the mus level, not at the views level. |
234 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 238 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
235 params.delegate = this; | 239 params.delegate = this; |
236 params.native_widget = | 240 params.native_widget = |
237 new WmNativeWidgetMus(widget_, window, window_manager_client); | 241 new WmNativeWidgetMus(widget_, connector, window, window_manager_client); |
238 widget_->Init(params); | 242 widget_->Init(params); |
239 | 243 |
240 parent->AddChild(window); | 244 parent->AddChild(window); |
241 | 245 |
242 widget_->ShowInactive(); | 246 widget_->ShowInactive(); |
243 | 247 |
244 const int shadow_inset = | 248 const int shadow_inset = |
245 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); | 249 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); |
246 const gfx::Insets extended_hit_region = | 250 const gfx::Insets extended_hit_region = |
247 wm_window->ShouldUseExtendedHitRegion() | 251 wm_window->ShouldUseExtendedHitRegion() |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 328 } |
325 } | 329 } |
326 | 330 |
327 void NonClientFrameController::OnWindowDestroyed(ui::Window* window) { | 331 void NonClientFrameController::OnWindowDestroyed(ui::Window* window) { |
328 window_->RemoveObserver(this); | 332 window_->RemoveObserver(this); |
329 window_ = nullptr; | 333 window_ = nullptr; |
330 } | 334 } |
331 | 335 |
332 } // namespace mus | 336 } // namespace mus |
333 } // namespace ash | 337 } // namespace ash |
OLD | NEW |