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 #ifndef UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ | 5 #ifndef UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ |
6 #define UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ | 6 #define UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "components/mus/public/interfaces/window_manager.mojom.h" | 9 #include "components/mus/public/interfaces/window_manager.mojom.h" |
10 #include "ui/aura/window_delegate.h" | 10 #include "ui/aura/window_delegate.h" |
11 #include "ui/views/widget/native_widget_private.h" | 11 #include "ui/views/widget/native_widget_private.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 namespace client { | 14 namespace client { |
15 class DefaultCaptureClient; | 15 class DefaultCaptureClient; |
16 } | 16 } |
17 class Window; | 17 class Window; |
18 } | 18 } |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
21 class Shell; | 21 class Shell; |
22 } | 22 } |
23 | 23 |
24 namespace mus { | 24 namespace mus { |
25 class Window; | 25 class Window; |
| 26 |
| 27 namespace mojom { |
| 28 class WindowManager; |
| 29 } |
26 } | 30 } |
27 | 31 |
28 namespace wm { | 32 namespace wm { |
29 class FocusController; | 33 class FocusController; |
30 } | 34 } |
31 | 35 |
32 namespace views { | 36 namespace views { |
| 37 struct WindowManagerClientAreaInsets; |
33 class WindowTreeHostMus; | 38 class WindowTreeHostMus; |
34 | 39 |
35 // An implementation of NativeWidget that binds to a mus::Window. Because Aura | 40 // An implementation of NativeWidget that binds to a mus::Window. Because Aura |
36 // is used extensively within Views code, this code uses aura and binds to the | 41 // is used extensively within Views code, this code uses aura and binds to the |
37 // mus::Window via a Mus-specific aura::WindowTreeHost impl. Because the root | 42 // mus::Window via a Mus-specific aura::WindowTreeHost impl. Because the root |
38 // aura::Window in a hierarchy is created without a delegate by the | 43 // aura::Window in a hierarchy is created without a delegate by the |
39 // aura::WindowTreeHost, we must create a child aura::Window in this class | 44 // aura::WindowTreeHost, we must create a child aura::Window in this class |
40 // (content_) and attach it to the root. | 45 // (content_) and attach it to the root. |
41 class NativeWidgetMus : public internal::NativeWidgetPrivate, | 46 class NativeWidgetMus : public internal::NativeWidgetPrivate, |
42 public aura::WindowDelegate { | 47 public aura::WindowDelegate { |
43 public: | 48 public: |
44 NativeWidgetMus(internal::NativeWidgetDelegate* delegate, | 49 NativeWidgetMus(internal::NativeWidgetDelegate* delegate, |
45 mojo::Shell* shell, | 50 mojo::Shell* shell, |
46 mus::Window* window, | 51 mus::Window* window, |
47 mus::mojom::SurfaceType surface_type); | 52 mus::mojom::SurfaceType surface_type); |
48 ~NativeWidgetMus() override; | 53 ~NativeWidgetMus() override; |
49 | 54 |
| 55 // Sets the insets for the client area. These values come from the window |
| 56 // manager. |
| 57 static void SetWindowManagerClientAreaInsets( |
| 58 const WindowManagerClientAreaInsets& insets); |
| 59 |
| 60 mus::Window* window() { return window_; } |
| 61 |
| 62 protected: |
| 63 // internal::NativeWidgetPrivate: |
| 64 NonClientFrameView* CreateNonClientFrameView() override; |
| 65 |
50 private: | 66 private: |
51 void UpdateClientAreaInWindowManager(); | 67 void UpdateClientAreaInWindowManager(); |
52 | 68 |
53 // internal::NativeWidgetPrivate: | 69 // internal::NativeWidgetPrivate: |
54 void InitNativeWidget(const Widget::InitParams& params) override; | 70 void InitNativeWidget(const Widget::InitParams& params) override; |
55 NonClientFrameView* CreateNonClientFrameView() override; | |
56 bool ShouldUseNativeFrame() const override; | 71 bool ShouldUseNativeFrame() const override; |
57 bool ShouldWindowContentsBeTransparent() const override; | 72 bool ShouldWindowContentsBeTransparent() const override; |
58 void FrameTypeChanged() override; | 73 void FrameTypeChanged() override; |
59 Widget* GetWidget() override; | 74 Widget* GetWidget() override; |
60 const Widget* GetWidget() const override; | 75 const Widget* GetWidget() const override; |
61 gfx::NativeView GetNativeView() const override; | 76 gfx::NativeView GetNativeView() const override; |
62 gfx::NativeWindow GetNativeWindow() const override; | 77 gfx::NativeWindow GetNativeWindow() const override; |
63 Widget* GetTopLevelWidget() override; | 78 Widget* GetTopLevelWidget() override; |
64 const ui::Compositor* GetCompositor() const override; | 79 const ui::Compositor* GetCompositor() const override; |
65 const ui::Layer* GetLayer() const override; | 80 const ui::Layer* GetLayer() const override; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 aura::Window* content_; | 192 aura::Window* content_; |
178 scoped_ptr<wm::FocusController> focus_client_; | 193 scoped_ptr<wm::FocusController> focus_client_; |
179 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 194 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
180 | 195 |
181 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMus); | 196 DISALLOW_COPY_AND_ASSIGN(NativeWidgetMus); |
182 }; | 197 }; |
183 | 198 |
184 } // namespace views | 199 } // namespace views |
185 | 200 |
186 #endif // UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ | 201 #endif // UI_VIEWS_MUS_NATIVE_WIDGET_MUS_H_ |
OLD | NEW |