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 #ifndef ASH_MUS_FRAME_DETACHED_TITLE_AREA_RENDERER_H_ | 5 #ifndef ASH_MUS_FRAME_DETACHED_TITLE_AREA_RENDERER_H_ |
6 #define ASH_MUS_FRAME_DETACHED_TITLE_AREA_RENDERER_H_ | 6 #define ASH_MUS_FRAME_DETACHED_TITLE_AREA_RENDERER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/views/widget/widget_delegate.h" | 9 #include "ui/views/widget/widget_delegate.h" |
10 | 10 |
11 namespace ui { | |
12 class Window; | |
13 } | |
14 | |
15 namespace ash { | 11 namespace ash { |
16 namespace mus { | 12 namespace mus { |
17 | 13 |
18 class DetachedTitleAreaRendererHost; | 14 class DetachedTitleAreaRendererHost; |
19 | 15 |
20 // DetachedTitleAreaRenderer contains a HeaderView in a widget. It's intended to | 16 // DetachedTitleAreaRenderer contains a HeaderView in a widget. It's intended to |
21 // be used when the title area needs to be rendered in a window different from | 17 // be used when the title area needs to be rendered in a window different from |
22 // the normal window the title area renders to (such as in immersive mode). | 18 // the normal window the title area renders to (such as in immersive mode). |
23 class DetachedTitleAreaRenderer : public views::WidgetDelegate { | 19 class DetachedTitleAreaRenderer : public views::WidgetDelegate { |
24 public: | 20 public: |
25 // Used to indicate why this is being created. | 21 // Used to indicate why this is being created. |
26 enum class Source { | 22 enum class Source { |
27 // This is being created at the request of a client, specifically because | 23 // This is being created at the request of a client, specifically because |
28 // of kRendererParentTitleArea_Property set on a client owned window. | 24 // of kRendererParentTitleArea_Property set on a client owned window. |
29 CLIENT, | 25 CLIENT, |
30 | 26 |
31 // Mash is creating this class to host an immersive reveal. Note that CLIENT | 27 // Mash is creating this class to host an immersive reveal. Note that CLIENT |
32 // is also likely used for an immersive reveal, but for CLIENT the client | 28 // is also likely used for an immersive reveal, but for CLIENT the client |
33 // is completely controlling the reveal and not mash. In other words for | 29 // is completely controlling the reveal and not mash. In other words for |
34 // CLIENT ImmersiveFullscreenController is not running in mash. | 30 // CLIENT ImmersiveFullscreenController is not running in mash. |
35 MASH, | 31 MASH, |
36 }; | 32 }; |
37 | 33 |
38 // Creates a widget to render the title area and shows it. |window| is the | 34 // Creates a widget to render the title area and shows it. |frame| is the |
39 // window to render to and |widget| the widget whose frame state is rendered | 35 // widget whose frame state is rendered to. This object is deleted explicitly |
40 // to |window|. This object is deleted either when |window| is destroyed, or | 36 // by calling Destroy(). |
41 // Destroy() is called. | |
42 DetachedTitleAreaRenderer(DetachedTitleAreaRendererHost* host, | 37 DetachedTitleAreaRenderer(DetachedTitleAreaRendererHost* host, |
43 views::Widget* frame, | 38 views::Widget* frame, |
44 ui::Window* window, | 39 const gfx::Rect& bounds, |
45 Source source); | 40 Source source); |
46 | 41 |
47 void Destroy(); | 42 void Destroy(); |
48 | 43 |
49 views::Widget* widget() { return widget_; } | 44 views::Widget* widget() { return widget_; } |
50 | 45 |
51 // views::WidgetDelegate: | 46 // views::WidgetDelegate: |
52 views::Widget* GetWidget() override; | 47 views::Widget* GetWidget() override; |
53 const views::Widget* GetWidget() const override; | 48 const views::Widget* GetWidget() const override; |
54 void DeleteDelegate() override; | 49 void DeleteDelegate() override; |
55 | 50 |
56 private: | 51 private: |
57 ~DetachedTitleAreaRenderer() override; | 52 ~DetachedTitleAreaRenderer() override; |
58 | 53 |
59 DetachedTitleAreaRendererHost* host_; | 54 DetachedTitleAreaRendererHost* host_; |
60 views::Widget* frame_; | 55 views::Widget* frame_; |
61 views::Widget* widget_; | 56 views::Widget* widget_; |
62 | 57 |
63 DISALLOW_COPY_AND_ASSIGN(DetachedTitleAreaRenderer); | 58 DISALLOW_COPY_AND_ASSIGN(DetachedTitleAreaRenderer); |
64 }; | 59 }; |
65 | 60 |
66 } // namespace mus | 61 } // namespace mus |
67 } // namespace ash | 62 } // namespace ash |
68 | 63 |
69 #endif // ASH_MUS_FRAME_DETACHED_TITLE_AREA_RENDERER_H_ | 64 #endif // ASH_MUS_FRAME_DETACHED_TITLE_AREA_RENDERER_H_ |
OLD | NEW |