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 "mash/wm/non_client_frame_controller.h" | 5 #include "mash/wm/non_client_frame_controller.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/mus/public/cpp/property_type_converters.h" | 10 #include "components/mus/public/cpp/property_type_converters.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 aura::Window* window_; | 83 aura::Window* window_; |
84 const ShadowStyle style_; | 84 const ShadowStyle style_; |
85 Shadow* shadow_; | 85 Shadow* shadow_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); | 87 DISALLOW_COPY_AND_ASSIGN(ContentWindowLayoutManager); |
88 }; | 88 }; |
89 | 89 |
90 class WmNativeWidgetMus : public views::NativeWidgetMus { | 90 class WmNativeWidgetMus : public views::NativeWidgetMus { |
91 public: | 91 public: |
92 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, | 92 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, |
93 mojo::Shell* shell, | 93 mojo::Connector* connector, |
94 mus::Window* window) | 94 mus::Window* window) |
95 : NativeWidgetMus(delegate, shell, window, | 95 : NativeWidgetMus(delegate, connector, window, |
96 mus::mojom::SurfaceType::UNDERLAY) {} | 96 mus::mojom::SurfaceType::UNDERLAY) {} |
97 ~WmNativeWidgetMus() override { | 97 ~WmNativeWidgetMus() override { |
98 } | 98 } |
99 | 99 |
100 // NativeWidgetMus: | 100 // NativeWidgetMus: |
101 views::NonClientFrameView* CreateNonClientFrameView() override { | 101 views::NonClientFrameView* CreateNonClientFrameView() override { |
102 views::Widget* widget = | 102 views::Widget* widget = |
103 static_cast<views::internal::NativeWidgetPrivate*>(this)->GetWidget(); | 103 static_cast<views::internal::NativeWidgetPrivate*>(this)->GetWidget(); |
104 NonClientFrameViewMash* frame_view = | 104 NonClientFrameViewMash* frame_view = |
105 new NonClientFrameViewMash(widget, window()); | 105 new NonClientFrameViewMash(widget, window()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 private: | 160 private: |
161 NonClientFrameController* frame_controller_; | 161 NonClientFrameController* frame_controller_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(ClientViewMus); | 163 DISALLOW_COPY_AND_ASSIGN(ClientViewMus); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace | 166 } // namespace |
167 | 167 |
168 NonClientFrameController::NonClientFrameController( | 168 NonClientFrameController::NonClientFrameController( |
169 mojo::Shell* shell, | 169 mojo::Connector* connector, |
170 mus::Window* window, | 170 mus::Window* window, |
171 mus::WindowManagerClient* window_manager_client) | 171 mus::WindowManagerClient* window_manager_client) |
172 : widget_(new views::Widget), window_(window) { | 172 : widget_(new views::Widget), window_(window) { |
173 window_->AddObserver(this); | 173 window_->AddObserver(this); |
174 | 174 |
175 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 175 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
176 // We initiate focus at the mus level, not at the views level. | 176 // We initiate focus at the mus level, not at the views level. |
177 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 177 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
178 params.delegate = this; | 178 params.delegate = this; |
179 params.native_widget = new WmNativeWidgetMus(widget_, shell, window); | 179 params.native_widget = new WmNativeWidgetMus(widget_, connector, window); |
180 widget_->Init(params); | 180 widget_->Init(params); |
181 widget_->ShowInactive(); | 181 widget_->ShowInactive(); |
182 | 182 |
183 const int shadow_inset = | 183 const int shadow_inset = |
184 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); | 184 Shadow::GetInteriorInsetForStyle(Shadow::STYLE_ACTIVE); |
185 window_manager_client->SetUnderlaySurfaceOffsetAndExtendedHitArea( | 185 window_manager_client->SetUnderlaySurfaceOffsetAndExtendedHitArea( |
186 window, gfx::Vector2d(shadow_inset, shadow_inset), | 186 window, gfx::Vector2d(shadow_inset, shadow_inset), |
187 FrameBorderHitTestController::GetResizeOutsideBoundsSize()); | 187 FrameBorderHitTestController::GetResizeOutsideBoundsSize()); |
188 } | 188 } |
189 | 189 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 widget_->UpdateWindowTitle(); | 250 widget_->UpdateWindowTitle(); |
251 } | 251 } |
252 | 252 |
253 void NonClientFrameController::OnWindowDestroyed(mus::Window* window) { | 253 void NonClientFrameController::OnWindowDestroyed(mus::Window* window) { |
254 window_->RemoveObserver(this); | 254 window_->RemoveObserver(this); |
255 window_ = nullptr; | 255 window_ = nullptr; |
256 } | 256 } |
257 | 257 |
258 } // namespace wm | 258 } // namespace wm |
259 } // namespace mash | 259 } // namespace mash |
OLD | NEW |