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 #ifndef MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ | |
6 #define MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/mus/public/cpp/window_observer.h" | |
10 #include "components/mus/public/cpp/window_tree_client_observer.h" | |
11 #include "third_party/skia/include/core/SkColor.h" | |
12 #include "ui/compositor/paint_cache.h" | |
13 #include "ui/views/window/non_client_view.h" | |
14 | |
15 namespace gfx { | |
16 class Insets; | |
17 } | |
18 | |
19 namespace mus { | |
20 class Window; | |
21 } | |
22 | |
23 namespace views { | |
24 class Widget; | |
25 } | |
26 | |
27 namespace mash { | |
28 namespace wm { | |
29 | |
30 class FrameCaptionButtonContainerView; | |
31 | |
32 class NonClientFrameViewMash : public views::NonClientFrameView, | |
33 public mus::WindowObserver, | |
34 public mus::WindowTreeClientObserver { | |
35 public: | |
36 // Internal class name. | |
37 static const char kViewClassName[]; | |
38 | |
39 NonClientFrameViewMash(views::Widget* frame, mus::Window* window); | |
40 ~NonClientFrameViewMash() override; | |
41 | |
42 static gfx::Insets GetPreferredClientAreaInsets(); | |
43 static int GetMaxTitleBarButtonWidth(); | |
44 | |
45 // Sets the active and inactive frame colors. Note the inactive frame color | |
46 // will have some transparency added when the frame is drawn. | |
47 void SetFrameColors(SkColor active_frame_color, SkColor inactive_frame_color); | |
48 | |
49 // views::NonClientFrameView: | |
50 gfx::Rect GetBoundsForClientView() const override; | |
51 gfx::Rect GetWindowBoundsForClientBounds( | |
52 const gfx::Rect& client_bounds) const override; | |
53 int NonClientHitTest(const gfx::Point& point) override; | |
54 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override; | |
55 void ResetWindowControls() override; | |
56 void UpdateWindowIcon() override; | |
57 void UpdateWindowTitle() override; | |
58 void SizeConstraintsChanged() override; | |
59 | |
60 // views::View: | |
61 void Layout() override; | |
62 gfx::Size GetPreferredSize() const override; | |
63 const char* GetClassName() const override; | |
64 gfx::Size GetMinimumSize() const override; | |
65 gfx::Size GetMaximumSize() const override; | |
66 void OnPaint(gfx::Canvas* canvas) override; | |
67 void PaintChildren(const ui::PaintContext& context) override; | |
68 | |
69 // mus::WindowObserver: | |
70 void OnWindowClientAreaChanged( | |
71 mus::Window* window, | |
72 const gfx::Insets& old_client_area, | |
73 const std::vector<gfx::Rect>& old_additional_client_area) override; | |
74 void OnWindowDestroyed(mus::Window* window) override; | |
75 void OnWindowSharedPropertyChanged( | |
76 mus::Window* window, | |
77 const std::string& name, | |
78 const std::vector<uint8_t>* old_data, | |
79 const std::vector<uint8_t>* new_data) override; | |
80 | |
81 // Get the view of the header. | |
82 views::View* GetHeaderView(); | |
83 | |
84 private: | |
85 class OverlayView; | |
86 | |
87 // Height from top of window to top of client area. | |
88 int NonClientTopBorderHeight() const; | |
89 | |
90 void RemoveObservers(); | |
91 | |
92 // mus::WindowTreeClientObserver: | |
93 void OnWindowTreeFocusChanged(mus::Window* gained_focus, | |
94 mus::Window* lost_focus) override; | |
95 | |
96 // Not owned. | |
97 views::Widget* frame_; | |
98 | |
99 mus::Window* window_; | |
100 ui::PaintCache paint_cache_; | |
101 | |
102 // View which contains the title and window controls. | |
103 class HeaderView; | |
104 HeaderView* header_view_; | |
105 | |
106 DISALLOW_COPY_AND_ASSIGN(NonClientFrameViewMash); | |
107 }; | |
108 | |
109 } // namespace wm | |
110 } // namespace mash | |
111 | |
112 #endif // MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ | |
OLD | NEW |