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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 }; | 86 }; |
87 | 87 |
88 class WmNativeWidgetMus : public views::NativeWidgetMus { | 88 class WmNativeWidgetMus : public views::NativeWidgetMus { |
89 public: | 89 public: |
90 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, | 90 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, |
91 mojo::Shell* shell, | 91 mojo::Shell* shell, |
92 mus::Window* window) | 92 mus::Window* window) |
93 : NativeWidgetMus(delegate, | 93 : NativeWidgetMus(delegate, |
94 shell, | 94 shell, |
95 window, | 95 window, |
96 mus::mojom::SURFACE_TYPE_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()); |
106 move_event_handler_.reset(new MoveEventHandler(window(), GetNativeView())); | 106 move_event_handler_.reset(new MoveEventHandler(window(), GetNativeView())); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 return window_->GetSharedProperty<base::string16>( | 214 return window_->GetSharedProperty<base::string16>( |
215 mus::mojom::WindowManager::kWindowTitle_Property); | 215 mus::mojom::WindowManager::kWindowTitle_Property); |
216 } | 216 } |
217 | 217 |
218 views::View* NonClientFrameController::GetContentsView() { | 218 views::View* NonClientFrameController::GetContentsView() { |
219 return this; | 219 return this; |
220 } | 220 } |
221 | 221 |
222 bool NonClientFrameController::CanResize() const { | 222 bool NonClientFrameController::CanResize() const { |
223 return window_ && | 223 return window_ && |
224 (GetResizeBehavior(window_) & | 224 (GetResizeBehavior(window_) & mus::mojom::kResizeBehaviorCanResize) != |
225 mus::mojom::RESIZE_BEHAVIOR_CAN_RESIZE) != 0; | 225 0; |
226 } | 226 } |
227 | 227 |
228 bool NonClientFrameController::CanMaximize() const { | 228 bool NonClientFrameController::CanMaximize() const { |
229 return window_ && | 229 return window_ && |
230 (GetResizeBehavior(window_) & | 230 (GetResizeBehavior(window_) & |
231 mus::mojom::RESIZE_BEHAVIOR_CAN_MAXIMIZE) != 0; | 231 mus::mojom::kResizeBehaviorCanMaximize) != 0; |
232 } | 232 } |
233 | 233 |
234 bool NonClientFrameController::CanMinimize() const { | 234 bool NonClientFrameController::CanMinimize() const { |
235 return window_ && | 235 return window_ && |
236 (GetResizeBehavior(window_) & | 236 (GetResizeBehavior(window_) & |
237 mus::mojom::RESIZE_BEHAVIOR_CAN_MINIMIZE) != 0; | 237 mus::mojom::kResizeBehaviorCanMinimize) != 0; |
238 } | 238 } |
239 | 239 |
240 views::ClientView* NonClientFrameController::CreateClientView( | 240 views::ClientView* NonClientFrameController::CreateClientView( |
241 views::Widget* widget) { | 241 views::Widget* widget) { |
242 return new ClientViewMus(widget, GetContentsView(), this); | 242 return new ClientViewMus(widget, GetContentsView(), this); |
243 } | 243 } |
244 | 244 |
245 void NonClientFrameController::OnWindowSharedPropertyChanged( | 245 void NonClientFrameController::OnWindowSharedPropertyChanged( |
246 mus::Window* window, | 246 mus::Window* window, |
247 const std::string& name, | 247 const std::string& name, |
248 const std::vector<uint8_t>* old_data, | 248 const std::vector<uint8_t>* old_data, |
249 const std::vector<uint8_t>* new_data) { | 249 const std::vector<uint8_t>* new_data) { |
250 if (name == mus::mojom::WindowManager::kResizeBehavior_Property) | 250 if (name == mus::mojom::WindowManager::kResizeBehavior_Property) |
251 widget_->OnSizeConstraintsChanged(); | 251 widget_->OnSizeConstraintsChanged(); |
252 else if (name == mus::mojom::WindowManager::kWindowTitle_Property) | 252 else if (name == mus::mojom::WindowManager::kWindowTitle_Property) |
253 widget_->UpdateWindowTitle(); | 253 widget_->UpdateWindowTitle(); |
254 } | 254 } |
255 | 255 |
256 void NonClientFrameController::OnWindowDestroyed(mus::Window* window) { | 256 void NonClientFrameController::OnWindowDestroyed(mus::Window* window) { |
257 window_->RemoveObserver(this); | 257 window_->RemoveObserver(this); |
258 window_ = nullptr; | 258 window_ = nullptr; |
259 } | 259 } |
260 | 260 |
261 } // namespace wm | 261 } // namespace wm |
262 } // namespace mash | 262 } // namespace mash |
OLD | NEW |