OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 #ifndef ASH_COMMON_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ | |
6 #define ASH_COMMON_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "base/macros.h" | |
12 #include "third_party/skia/include/core/SkColor.h" | |
13 #include "ui/views/window/non_client_view.h" | |
14 | |
15 namespace views { | |
16 class Widget; | |
17 } | |
18 | |
19 namespace ash { | |
20 | |
21 class FrameCaptionButtonContainerView; | |
22 class HeaderView; | |
23 class ImmersiveFullscreenController; | |
24 class ImmersiveFullscreenControllerDelegate; | |
25 | |
26 // A NonClientFrameView used for packaged apps, dialogs and other non-browser | |
27 // windows. It supports immersive fullscreen. When in immersive fullscreen, the | |
28 // client view takes up the entire widget and the window header is an overlay. | |
29 // The window header overlay slides onscreen when the user hovers the mouse at | |
30 // the top of the screen. See also views::CustomFrameView and | |
31 // BrowserNonClientFrameViewAsh. | |
32 class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView { | |
33 public: | |
34 // Internal class name. | |
35 static const char kViewClassName[]; | |
36 | |
37 // |enable_immersive| controls whether ImmersiveFullscreenController is | |
38 // created for the CustomFrameViewAsh; if true and a WindowStateDelegate has | |
39 // not been set on the WindowState associated with |frame|, then an | |
40 // ImmersiveFullscreenController is created. | |
41 // If ImmersiveFullscreenControllerDelegate is not supplied, HeaderView is | |
42 // used as the ImmersiveFullscreenControllerDelegate. | |
43 explicit CustomFrameViewAsh( | |
44 views::Widget* frame, | |
45 ImmersiveFullscreenControllerDelegate* immersive_delegate = nullptr, | |
46 bool enable_immersive = true); | |
47 ~CustomFrameViewAsh() override; | |
48 | |
49 // Inits |immersive_fullscreen_controller| so that the controller reveals | |
50 // and hides |header_view_| in immersive fullscreen. | |
51 // CustomFrameViewAsh does not take ownership of | |
52 // |immersive_fullscreen_controller|. | |
53 void InitImmersiveFullscreenControllerForView( | |
54 ImmersiveFullscreenController* immersive_fullscreen_controller); | |
55 | |
56 // Sets the active and inactive frame colors. Note the inactive frame color | |
57 // will have some transparency added when the frame is drawn. | |
58 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); | |
59 | |
60 // views::NonClientFrameView: | |
61 gfx::Rect GetBoundsForClientView() const override; | |
62 gfx::Rect GetWindowBoundsForClientBounds( | |
63 const gfx::Rect& client_bounds) const override; | |
64 int NonClientHitTest(const gfx::Point& point) override; | |
65 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | |
66 void ResetWindowControls() override; | |
67 void UpdateWindowIcon() override; | |
68 void UpdateWindowTitle() override; | |
69 void SizeConstraintsChanged() override; | |
70 void ActivationChanged(bool active) override; | |
71 | |
72 // views::View: | |
73 gfx::Size GetPreferredSize() const override; | |
74 void Layout() override; | |
75 const char* GetClassName() const override; | |
76 gfx::Size GetMinimumSize() const override; | |
77 gfx::Size GetMaximumSize() const override; | |
78 void SchedulePaintInRect(const gfx::Rect& r) override; | |
79 void VisibilityChanged(views::View* starting_from, bool is_visible) override; | |
80 | |
81 // Get the view of the header. | |
82 views::View* GetHeaderView(); | |
83 | |
84 const views::View* GetAvatarIconViewForTest() const; | |
85 | |
86 private: | |
87 class OverlayView; | |
88 friend class TestWidgetConstraintsDelegate; | |
89 | |
90 // views::NonClientFrameView: | |
91 bool DoesIntersectRect(const views::View* target, | |
92 const gfx::Rect& rect) const override; | |
93 | |
94 // Returns the container for the minimize/maximize/close buttons that is held | |
95 // by the HeaderView. Used in testing. | |
96 FrameCaptionButtonContainerView* GetFrameCaptionButtonContainerViewForTest(); | |
97 | |
98 // Height from top of window to top of client area. | |
99 int NonClientTopBorderHeight() const; | |
100 | |
101 // Not owned. | |
102 views::Widget* frame_; | |
103 | |
104 // View which contains the title and window controls. | |
105 HeaderView* header_view_; | |
106 | |
107 ImmersiveFullscreenControllerDelegate* immersive_delegate_; | |
108 | |
109 DISALLOW_COPY_AND_ASSIGN(CustomFrameViewAsh); | |
110 }; | |
111 | |
112 } // namespace ash | |
113 | |
114 #endif // ASH_COMMON_FRAME_CUSTOM_FRAME_VIEW_ASH_H_ | |
OLD | NEW |