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 "ui/views/mus/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
9 #include "components/mus/public/cpp/property_type_converters.h" | 9 #include "components/mus/public/cpp/property_type_converters.h" |
10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 void SizeConstraintsChanged() override { | 149 void SizeConstraintsChanged() override { |
150 // NOTIMPLEMENTED(); | 150 // NOTIMPLEMENTED(); |
151 } | 151 } |
152 | 152 |
153 views::Widget* widget_; | 153 views::Widget* widget_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView); | 155 DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView); |
156 }; | 156 }; |
157 | 157 |
158 mus::mojom::ResizeBehavior ResizeBehaviorFromDelegate( | 158 int ResizeBehaviorFromDelegate(WidgetDelegate* delegate) { |
159 WidgetDelegate* delegate) { | 159 int32_t behavior = mus::mojom::kResizeBehaviorNone; |
160 int32_t behavior = mus::mojom::RESIZE_BEHAVIOR_NONE; | |
161 if (delegate->CanResize()) | 160 if (delegate->CanResize()) |
162 behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_RESIZE; | 161 behavior |= mus::mojom::kResizeBehaviorCanResize; |
163 if (delegate->CanMaximize()) | 162 if (delegate->CanMaximize()) |
164 behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_MAXIMIZE; | 163 behavior |= mus::mojom::kResizeBehaviorCanMaximize; |
165 if (delegate->CanMinimize()) | 164 if (delegate->CanMinimize()) |
166 behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_MINIMIZE; | 165 behavior |= mus::mojom::kResizeBehaviorCanMinimize; |
167 return static_cast<mus::mojom::ResizeBehavior>(behavior); | 166 return behavior; |
168 } | 167 } |
169 | 168 |
170 } // namespace | 169 } // namespace |
171 | 170 |
172 //////////////////////////////////////////////////////////////////////////////// | 171 //////////////////////////////////////////////////////////////////////////////// |
173 // NativeWidgetMus, public: | 172 // NativeWidgetMus, public: |
174 | 173 |
175 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, | 174 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, |
176 mojo::Shell* shell, | 175 mojo::Shell* shell, |
177 mus::Window* window, | 176 mus::Window* window, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 (*properties)[mus::mojom::WindowManager::kUserSetBounds_Property] = | 247 (*properties)[mus::mojom::WindowManager::kUserSetBounds_Property] = |
249 mojo::TypeConverter<const std::vector<uint8_t>, gfx::Rect>::Convert( | 248 mojo::TypeConverter<const std::vector<uint8_t>, gfx::Rect>::Convert( |
250 init_params.bounds); | 249 init_params.bounds); |
251 } | 250 } |
252 | 251 |
253 if (!Widget::RequiresNonClientView(init_params.type)) | 252 if (!Widget::RequiresNonClientView(init_params.type)) |
254 return; | 253 return; |
255 | 254 |
256 (*properties)[mus::mojom::WindowManager::kWindowType_Property] = | 255 (*properties)[mus::mojom::WindowManager::kWindowType_Property] = |
257 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 256 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
258 mojo::ConvertTo<mus::mojom::WindowType>(init_params.type)); | 257 static_cast<int32_t>( |
| 258 mojo::ConvertTo<mus::mojom::WindowType>(init_params.type))); |
259 (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = | 259 (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = |
260 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 260 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
261 ResizeBehaviorFromDelegate(init_params.delegate)); | 261 ResizeBehaviorFromDelegate(init_params.delegate)); |
262 } | 262 } |
263 | 263 |
264 //////////////////////////////////////////////////////////////////////////////// | 264 //////////////////////////////////////////////////////////////////////////////// |
265 // NativeWidgetMus, internal::NativeWidgetPrivate implementation: | 265 // NativeWidgetMus, internal::NativeWidgetPrivate implementation: |
266 | 266 |
267 NonClientFrameView* NativeWidgetMus::CreateNonClientFrameView() { | 267 NonClientFrameView* NativeWidgetMus::CreateNonClientFrameView() { |
268 return new ClientSideNonClientFrameView(GetWidget()); | 268 return new ClientSideNonClientFrameView(GetWidget()); |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 | 830 |
831 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { | 831 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { |
832 native_widget_delegate_->OnGestureEvent(event); | 832 native_widget_delegate_->OnGestureEvent(event); |
833 } | 833 } |
834 | 834 |
835 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { | 835 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { |
836 GetWidget()->Close(); | 836 GetWidget()->Close(); |
837 } | 837 } |
838 | 838 |
839 } // namespace views | 839 } // namespace views |
OLD | NEW |