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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 void SizeConstraintsChanged() override { | 144 void SizeConstraintsChanged() override { |
145 // NOTIMPLEMENTED(); | 145 // NOTIMPLEMENTED(); |
146 } | 146 } |
147 | 147 |
148 views::Widget* widget_; | 148 views::Widget* widget_; |
149 | 149 |
150 DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView); | 150 DISALLOW_COPY_AND_ASSIGN(ClientSideNonClientFrameView); |
151 }; | 151 }; |
152 | 152 |
153 mus::mojom::ResizeBehavior ResizeBehaviorFromDelegate( | 153 int ResizeBehaviorFromDelegate(WidgetDelegate* delegate) { |
154 WidgetDelegate* delegate) { | 154 int32_t behavior = mus::mojom::kResizeBehaviorNone; |
155 int32_t behavior = mus::mojom::RESIZE_BEHAVIOR_NONE; | |
156 if (delegate->CanResize()) | 155 if (delegate->CanResize()) |
157 behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_RESIZE; | 156 behavior |= mus::mojom::kResizeBehaviorCanResize; |
158 if (delegate->CanMaximize()) | 157 if (delegate->CanMaximize()) |
159 behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_MAXIMIZE; | 158 behavior |= mus::mojom::kResizeBehaviorCanMaximize; |
160 if (delegate->CanMinimize()) | 159 if (delegate->CanMinimize()) |
161 behavior |= mus::mojom::RESIZE_BEHAVIOR_CAN_MINIMIZE; | 160 behavior |= mus::mojom::kResizeBehaviorCanMinimize; |
162 return static_cast<mus::mojom::ResizeBehavior>(behavior); | 161 return behavior; |
163 } | 162 } |
164 | 163 |
165 } // namespace | 164 } // namespace |
166 | 165 |
167 //////////////////////////////////////////////////////////////////////////////// | 166 //////////////////////////////////////////////////////////////////////////////// |
168 // NativeWidgetMus, public: | 167 // NativeWidgetMus, public: |
169 | 168 |
170 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, | 169 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, |
171 mojo::Shell* shell, | 170 mojo::Shell* shell, |
172 mus::Window* window, | 171 mus::Window* window, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 236 |
238 // static | 237 // static |
239 void NativeWidgetMus::ConfigurePropertiesForNewWindow( | 238 void NativeWidgetMus::ConfigurePropertiesForNewWindow( |
240 const Widget::InitParams& init_params, | 239 const Widget::InitParams& init_params, |
241 std::map<std::string, std::vector<uint8_t>>* properties) { | 240 std::map<std::string, std::vector<uint8_t>>* properties) { |
242 if (!Widget::RequiresNonClientView(init_params.type)) | 241 if (!Widget::RequiresNonClientView(init_params.type)) |
243 return; | 242 return; |
244 | 243 |
245 (*properties)[mus::mojom::WindowManager::kWindowType_Property] = | 244 (*properties)[mus::mojom::WindowManager::kWindowType_Property] = |
246 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 245 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
247 mojo::ConvertTo<mus::mojom::WindowType>(init_params.type)); | 246 static_cast<int32_t>( |
| 247 mojo::ConvertTo<mus::mojom::WindowType>(init_params.type))); |
248 ConfigurePropertiesForNewWindowFromDelegate(init_params.delegate, properties); | 248 ConfigurePropertiesForNewWindowFromDelegate(init_params.delegate, properties); |
249 } | 249 } |
250 | 250 |
251 void NativeWidgetMus::ConfigurePropertiesForNewWindowFromDelegate( | 251 void NativeWidgetMus::ConfigurePropertiesForNewWindowFromDelegate( |
252 WidgetDelegate* delegate, | 252 WidgetDelegate* delegate, |
253 std::map<std::string, std::vector<uint8_t>>* properties) { | 253 std::map<std::string, std::vector<uint8_t>>* properties) { |
254 (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = | 254 (*properties)[mus::mojom::WindowManager::kResizeBehavior_Property] = |
255 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( | 255 mojo::TypeConverter<const std::vector<uint8_t>, int32_t>::Convert( |
256 ResizeBehaviorFromDelegate(delegate)); | 256 ResizeBehaviorFromDelegate(delegate)); |
257 } | 257 } |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 | 808 |
809 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { | 809 void NativeWidgetMus::OnGestureEvent(ui::GestureEvent* event) { |
810 native_widget_delegate_->OnGestureEvent(event); | 810 native_widget_delegate_->OnGestureEvent(event); |
811 } | 811 } |
812 | 812 |
813 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { | 813 void NativeWidgetMus::OnHostCloseRequested(const aura::WindowTreeHost* host) { |
814 GetWidget()->Close(); | 814 GetWidget()->Close(); |
815 } | 815 } |
816 | 816 |
817 } // namespace views | 817 } // namespace views |
OLD | NEW |