Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/mus/example/wm/non_client_frame_controller.h" | |
| 6 | |
| 7 #include "components/mus/example/wm/non_client_frame_view_impl.h" | |
| 8 #include "components/mus/public/cpp/window.h" | |
| 9 #include "ui/views/mus/native_widget_mus.h" | |
| 10 #include "ui/views/widget/widget.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 class WmNativeWidgetMus : public views::NativeWidgetMus { | |
|
Ben Goodger (Google)
2015/11/04 23:03:21
I don't think you need to subclass here. Instead t
sky
2015/11/05 00:18:01
CustomFrameView and related classes assume they ar
| |
| 15 public: | |
| 16 WmNativeWidgetMus(views::internal::NativeWidgetDelegate* delegate, | |
| 17 mojo::Shell* shell, | |
| 18 mus::Window* window) | |
| 19 : NativeWidgetMus(delegate, | |
| 20 shell, | |
| 21 window, | |
| 22 mus::mojom::SURFACE_TYPE_UNDERLAY) {} | |
| 23 ~WmNativeWidgetMus() override {} | |
| 24 | |
| 25 // NativeWidgetMus: | |
| 26 views::NonClientFrameView* CreateNonClientFrameView() override { | |
| 27 NonClientFrameViewImpl* frame_view = new NonClientFrameViewImpl(window()); | |
| 28 frame_view->Init( | |
| 29 static_cast<views::internal::NativeWidgetPrivate*>(this)->GetWidget()); | |
| 30 return frame_view; | |
| 31 } | |
| 32 | |
| 33 private: | |
| 34 DISALLOW_COPY_AND_ASSIGN(WmNativeWidgetMus); | |
| 35 }; | |
| 36 | |
| 37 } // namespace | |
| 38 | |
| 39 NonClientFrameController::NonClientFrameController(mojo::Shell* shell, | |
| 40 mus::Window* window) { | |
| 41 views::Widget* widget = new views::Widget; | |
| 42 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | |
| 43 params.delegate = this; | |
| 44 params.native_widget = new WmNativeWidgetMus(widget, shell, window); | |
| 45 widget->Init(params); | |
| 46 widget->Show(); | |
| 47 } | |
| 48 | |
| 49 NonClientFrameController::~NonClientFrameController() {} | |
| 50 | |
| 51 views::View* NonClientFrameController::GetContentsView() { | |
| 52 return this; | |
| 53 } | |
| OLD | NEW |