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_COMMON_FRAME_HEADER_VIEW_H_ | 5 #ifndef ASH_COMMON_FRAME_HEADER_VIEW_H_ |
6 #define ASH_COMMON_FRAME_HEADER_VIEW_H_ | 6 #define ASH_COMMON_FRAME_HEADER_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/shell_observer.h" | 11 #include "ash/common/shell_observer.h" |
12 #include "ash/common/wm/immersive/wm_immersive_fullscreen_controller_delegate.h" | 12 #include "ash/shared/immersive_fullscreen_controller_delegate.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 class ImageView; | 18 class ImageView; |
19 class Widget; | 19 class Widget; |
20 } | 20 } |
21 | 21 |
22 namespace ash { | 22 namespace ash { |
23 | 23 |
24 class DefaultHeaderPainter; | 24 class DefaultHeaderPainter; |
25 class FrameCaptionButtonContainerView; | 25 class FrameCaptionButtonContainerView; |
26 | 26 |
27 // View which paints the frame header (title, caption buttons...). It slides off | 27 // View which paints the frame header (title, caption buttons...). It slides off |
28 // and on screen in immersive fullscreen. | 28 // and on screen in immersive fullscreen. |
29 class ASH_EXPORT HeaderView : public views::View, | 29 class ASH_EXPORT HeaderView : public views::View, |
30 public WmImmersiveFullscreenControllerDelegate, | 30 public ImmersiveFullscreenControllerDelegate, |
31 public ShellObserver { | 31 public ShellObserver { |
32 public: | 32 public: |
33 // |target_widget| is the widget that the caption buttons act on. | 33 // |target_widget| is the widget that the caption buttons act on. |
34 // |target_widget| is not necessarily the same as the widget the header is | 34 // |target_widget| is not necessarily the same as the widget the header is |
35 // placed in. For example, in immersive fullscreen this view may be painted in | 35 // placed in. For example, in immersive fullscreen this view may be painted in |
36 // a widget that slides in and out on top of the main app or browser window. | 36 // a widget that slides in and out on top of the main app or browser window. |
37 // However, clicking a caption button should act on the target widget. | 37 // However, clicking a caption button should act on the target widget. |
38 explicit HeaderView(views::Widget* target_widget); | 38 explicit HeaderView(views::Widget* target_widget); |
39 ~HeaderView() override; | 39 ~HeaderView() override; |
40 | 40 |
(...skipping 29 matching lines...) Expand all Loading... |
70 void OnMaximizeModeStarted() override; | 70 void OnMaximizeModeStarted() override; |
71 void OnMaximizeModeEnded() override; | 71 void OnMaximizeModeEnded() override; |
72 | 72 |
73 FrameCaptionButtonContainerView* caption_button_container() { | 73 FrameCaptionButtonContainerView* caption_button_container() { |
74 return caption_button_container_; | 74 return caption_button_container_; |
75 } | 75 } |
76 | 76 |
77 views::View* avatar_icon() const; | 77 views::View* avatar_icon() const; |
78 | 78 |
79 private: | 79 private: |
80 // WmImmersiveFullscreenControllerDelegate: | 80 // ImmersiveFullscreenControllerDelegate: |
81 void OnImmersiveRevealStarted() override; | 81 void OnImmersiveRevealStarted() override; |
82 void OnImmersiveRevealEnded() override; | 82 void OnImmersiveRevealEnded() override; |
83 void OnImmersiveFullscreenExited() override; | 83 void OnImmersiveFullscreenExited() override; |
84 void SetVisibleFraction(double visible_fraction) override; | 84 void SetVisibleFraction(double visible_fraction) override; |
85 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; | 85 std::vector<gfx::Rect> GetVisibleBoundsInScreen() const override; |
86 | 86 |
87 // The widget that the caption buttons act on. | 87 // The widget that the caption buttons act on. |
88 views::Widget* target_widget_; | 88 views::Widget* target_widget_; |
89 | 89 |
90 // Helper for painting the header. | 90 // Helper for painting the header. |
91 std::unique_ptr<DefaultHeaderPainter> header_painter_; | 91 std::unique_ptr<DefaultHeaderPainter> header_painter_; |
92 | 92 |
93 views::ImageView* avatar_icon_; | 93 views::ImageView* avatar_icon_; |
94 | 94 |
95 // View which contains the window caption buttons. | 95 // View which contains the window caption buttons. |
96 FrameCaptionButtonContainerView* caption_button_container_; | 96 FrameCaptionButtonContainerView* caption_button_container_; |
97 | 97 |
98 // The fraction of the header's height which is visible while in fullscreen. | 98 // The fraction of the header's height which is visible while in fullscreen. |
99 // This value is meaningless when not in fullscreen. | 99 // This value is meaningless when not in fullscreen. |
100 double fullscreen_visible_fraction_; | 100 double fullscreen_visible_fraction_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(HeaderView); | 102 DISALLOW_COPY_AND_ASSIGN(HeaderView); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace ash | 105 } // namespace ash |
106 | 106 |
107 #endif // ASH_COMMON_FRAME_HEADER_VIEW_H_ | 107 #endif // ASH_COMMON_FRAME_HEADER_VIEW_H_ |
OLD | NEW |