Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: ash/mus/native_widget_factory_mus.cc

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: add overrides Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/native_widget_factory_mus.h ('k') | ash/mus/non_client_frame_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/mus/native_widget_factory_mus.h"
6
7 #include "ash/common/wm_shell.h"
8 #include "ash/mus/bridge/wm_window_mus.h"
9 #include "ash/mus/window_manager.h"
10 #include "services/ui/public/cpp/property_type_converters.h"
11 #include "ui/views/mus/native_widget_mus.h"
12 #include "ui/views/views_delegate.h"
13 #include "ui/views/widget/widget.h"
14
15 namespace ash {
16 namespace mus {
17
18 namespace {
19
20 views::NativeWidget* CreateNativeWidgetMus(
21 WindowManager* window_manager,
22 const views::Widget::InitParams& init_params,
23 views::internal::NativeWidgetDelegate* delegate) {
24 // TYPE_CONTROL widgets require a NativeWidgetAura. So we let this fall
25 // through, so that the default NativeWidgetPrivate::CreateNativeWidget() is
26 // used instead.
27 if (init_params.type == views::Widget::InitParams::TYPE_CONTROL)
28 return nullptr;
29 std::map<std::string, std::vector<uint8_t>> props;
30 views::NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &props);
31 return new views::NativeWidgetMus(
32 delegate, window_manager->NewTopLevelWindow(&props),
33 ui::mojom::CompositorFrameSinkType::DEFAULT);
34 }
35
36 } // namespace
37
38 NativeWidgetFactoryMus::NativeWidgetFactoryMus(WindowManager* window_manager) {
39 views::ViewsDelegate::GetInstance()->set_native_widget_factory(
40 base::Bind(&CreateNativeWidgetMus, window_manager));
41 }
42
43 NativeWidgetFactoryMus::~NativeWidgetFactoryMus() {
44 if (views::ViewsDelegate::GetInstance()) {
45 views::ViewsDelegate::GetInstance()->set_native_widget_factory(
46 views::ViewsDelegate::NativeWidgetFactory());
47 }
48 }
49
50 } // namespace mus
51 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/native_widget_factory_mus.h ('k') | ash/mus/non_client_frame_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698