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 MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ | 5 #ifndef MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ |
6 #define MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ | 6 #define MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "components/mus/public/cpp/window_observer.h" | 10 #include "components/mus/public/cpp/window_observer.h" |
| 11 #include "components/mus/public/cpp/window_tree_connection_observer.h" |
11 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
12 #include "ui/compositor/paint_cache.h" | 13 #include "ui/compositor/paint_cache.h" |
13 #include "ui/views/window/non_client_view.h" | 14 #include "ui/views/window/non_client_view.h" |
14 | 15 |
15 namespace gfx { | 16 namespace gfx { |
16 class Insets; | 17 class Insets; |
17 } | 18 } |
18 | 19 |
19 namespace mus { | 20 namespace mus { |
20 class Window; | 21 class Window; |
21 } | 22 } |
22 | 23 |
23 namespace views { | 24 namespace views { |
24 class Widget; | 25 class Widget; |
25 } | 26 } |
26 | 27 |
27 namespace mash { | 28 namespace mash { |
28 namespace wm { | 29 namespace wm { |
29 | 30 |
30 class FrameCaptionButtonContainerView; | 31 class FrameCaptionButtonContainerView; |
31 | 32 |
32 class NonClientFrameViewMash : public views::NonClientFrameView, | 33 class NonClientFrameViewMash : public views::NonClientFrameView, |
33 public mus::WindowObserver { | 34 public mus::WindowObserver, |
| 35 public mus::WindowTreeConnectionObserver { |
34 public: | 36 public: |
35 // Internal class name. | 37 // Internal class name. |
36 static const char kViewClassName[]; | 38 static const char kViewClassName[]; |
37 | 39 |
38 NonClientFrameViewMash(views::Widget* frame, mus::Window* window); | 40 NonClientFrameViewMash(views::Widget* frame, mus::Window* window); |
39 ~NonClientFrameViewMash() override; | 41 ~NonClientFrameViewMash() override; |
40 | 42 |
41 static gfx::Insets GetPreferredClientAreaInsets(); | 43 static gfx::Insets GetPreferredClientAreaInsets(); |
42 static int GetMaxTitleBarButtonWidth(); | 44 static int GetMaxTitleBarButtonWidth(); |
43 | 45 |
(...skipping 20 matching lines...) Expand all Loading... |
64 gfx::Size GetMaximumSize() const override; | 66 gfx::Size GetMaximumSize() const override; |
65 void OnPaint(gfx::Canvas* canvas) override; | 67 void OnPaint(gfx::Canvas* canvas) override; |
66 void PaintChildren(const ui::PaintContext& context) override; | 68 void PaintChildren(const ui::PaintContext& context) override; |
67 | 69 |
68 // mus::WindowObserver: | 70 // mus::WindowObserver: |
69 void OnWindowClientAreaChanged( | 71 void OnWindowClientAreaChanged( |
70 mus::Window* window, | 72 mus::Window* window, |
71 const gfx::Insets& old_client_area, | 73 const gfx::Insets& old_client_area, |
72 const std::vector<gfx::Rect>& old_additional_client_area) override; | 74 const std::vector<gfx::Rect>& old_additional_client_area) override; |
73 void OnWindowDestroyed(mus::Window* window) override; | 75 void OnWindowDestroyed(mus::Window* window) override; |
| 76 void OnWindowSharedPropertyChanged( |
| 77 mus::Window* window, |
| 78 const std::string& name, |
| 79 const std::vector<uint8_t>* old_data, |
| 80 const std::vector<uint8_t>* new_data) override; |
74 | 81 |
75 // Get the view of the header. | 82 // Get the view of the header. |
76 views::View* GetHeaderView(); | 83 views::View* GetHeaderView(); |
77 | 84 |
78 private: | 85 private: |
79 class OverlayView; | 86 class OverlayView; |
80 | 87 |
81 // Height from top of window to top of client area. | 88 // Height from top of window to top of client area. |
82 int NonClientTopBorderHeight() const; | 89 int NonClientTopBorderHeight() const; |
83 | 90 |
| 91 void RemoveObservers(); |
| 92 |
| 93 // mus::WindowTreeConnectionObserver: |
| 94 void OnWindowTreeFocusChanged(mus::Window* gained_focus, |
| 95 mus::Window* lost_focus) override; |
| 96 |
84 // Not owned. | 97 // Not owned. |
85 views::Widget* frame_; | 98 views::Widget* frame_; |
86 | 99 |
87 mus::Window* window_; | 100 mus::Window* window_; |
88 ui::PaintCache paint_cache_; | 101 ui::PaintCache paint_cache_; |
89 | 102 |
90 // View which contains the title and window controls. | 103 // View which contains the title and window controls. |
91 class HeaderView; | 104 class HeaderView; |
92 HeaderView* header_view_; | 105 HeaderView* header_view_; |
93 | 106 |
94 DISALLOW_COPY_AND_ASSIGN(NonClientFrameViewMash); | 107 DISALLOW_COPY_AND_ASSIGN(NonClientFrameViewMash); |
95 }; | 108 }; |
96 | 109 |
97 } // namespace wm | 110 } // namespace wm |
98 } // namespace mash | 111 } // namespace mash |
99 | 112 |
100 #endif // MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ | 113 #endif // MASH_WM_FRAME_NON_CLIENT_FRAME_VIEW_MASH_H_ |
OLD | NEW |