| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/native_widget_factory_mus.h" | 5 #include "ash/mus/native_widget_factory_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/mus/bridge/wm_window_mus.h" | 8 #include "ash/mus/bridge/wm_window_mus.h" |
| 9 #include "ash/mus/window_manager.h" | 9 #include "ash/mus/window_manager.h" |
| 10 #include "services/ui/public/cpp/property_type_converters.h" | 10 #include "services/ui/public/cpp/property_type_converters.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 WindowManager* window_manager, | 21 WindowManager* window_manager, |
| 22 const views::Widget::InitParams& init_params, | 22 const views::Widget::InitParams& init_params, |
| 23 views::internal::NativeWidgetDelegate* delegate) { | 23 views::internal::NativeWidgetDelegate* delegate) { |
| 24 // TYPE_CONTROL widgets require a NativeWidgetAura. So we let this fall | 24 // TYPE_CONTROL widgets require a NativeWidgetAura. So we let this fall |
| 25 // through, so that the default NativeWidgetPrivate::CreateNativeWidget() is | 25 // through, so that the default NativeWidgetPrivate::CreateNativeWidget() is |
| 26 // used instead. | 26 // used instead. |
| 27 if (init_params.type == views::Widget::InitParams::TYPE_CONTROL) | 27 if (init_params.type == views::Widget::InitParams::TYPE_CONTROL) |
| 28 return nullptr; | 28 return nullptr; |
| 29 std::map<std::string, std::vector<uint8_t>> props; | 29 std::map<std::string, std::vector<uint8_t>> props; |
| 30 views::NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &props); | 30 views::NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &props); |
| 31 return new views::NativeWidgetMus(delegate, | 31 return new views::NativeWidgetMus( |
| 32 window_manager->NewTopLevelWindow(&props), | 32 delegate, window_manager->NewTopLevelWindow(&props), |
| 33 ui::mojom::SurfaceType::DEFAULT); | 33 ui::mojom::CompositorFrameSinkType::DEFAULT); |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace | 36 } // namespace |
| 37 | 37 |
| 38 NativeWidgetFactoryMus::NativeWidgetFactoryMus(WindowManager* window_manager) { | 38 NativeWidgetFactoryMus::NativeWidgetFactoryMus(WindowManager* window_manager) { |
| 39 views::ViewsDelegate::GetInstance()->set_native_widget_factory( | 39 views::ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 40 base::Bind(&CreateNativeWidgetMus, window_manager)); | 40 base::Bind(&CreateNativeWidgetMus, window_manager)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 NativeWidgetFactoryMus::~NativeWidgetFactoryMus() { | 43 NativeWidgetFactoryMus::~NativeWidgetFactoryMus() { |
| 44 if (views::ViewsDelegate::GetInstance()) { | 44 if (views::ViewsDelegate::GetInstance()) { |
| 45 views::ViewsDelegate::GetInstance()->set_native_widget_factory( | 45 views::ViewsDelegate::GetInstance()->set_native_widget_factory( |
| 46 views::ViewsDelegate::NativeWidgetFactory()); | 46 views::ViewsDelegate::NativeWidgetFactory()); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace mus | 50 } // namespace mus |
| 51 } // namespace ash | 51 } // namespace ash |
| OLD | NEW |