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_NON_CLIENT_FRAME_CONTROLLER_H_ | 5 #ifndef ASH_MUS_WM_NON_CLIENT_FRAME_CONTROLLER_H_ |
6 #define MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ | 6 #define ASH_MUS_WM_NON_CLIENT_FRAME_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "components/mus/public/cpp/window_observer.h" | 12 #include "components/mus/public/cpp/window_observer.h" |
13 #include "ui/views/widget/widget_delegate.h" | 13 #include "ui/views/widget/widget_delegate.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gfx { |
16 class Insets; | 16 class Insets; |
17 } | 17 } |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 class Shell; | 20 class Shell; |
21 } | 21 } |
22 | 22 |
23 namespace mus { | 23 namespace mus { |
24 class Window; | 24 class Window; |
25 namespace mojom { | 25 namespace mojom { |
26 class WindowTreeHost; | 26 class WindowTreeHost; |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 namespace mash { | 30 namespace ash { |
31 namespace wm { | 31 namespace muswm { |
32 | 32 |
33 // Provides the non-client frame for mus Windows. | 33 // Provides the non-client frame for mus Windows. |
34 class NonClientFrameController : public views::WidgetDelegateView, | 34 class NonClientFrameController : public views::WidgetDelegateView, |
35 public mus::WindowObserver { | 35 public mus::WindowObserver { |
36 public: | 36 public: |
37 // NonClientFrameController deletes itself when |window| is destroyed. | 37 // NonClientFrameController deletes itself when |window| is destroyed. |
38 NonClientFrameController(mojo::Shell* shell, | 38 NonClientFrameController(mojo::Shell* shell, |
39 mus::Window* window, | 39 mus::Window* window, |
40 mus::mojom::WindowTreeHost* window_tree_host); | 40 mus::mojom::WindowTreeHost* window_tree_host, |
| 41 aura::Window* aura_root); |
41 | 42 |
42 // Returns the preferred client area insets. | 43 // Returns the preferred client area insets. |
43 static gfx::Insets GetPreferredClientAreaInsets(); | 44 static gfx::Insets GetPreferredClientAreaInsets(); |
44 | 45 |
45 // Returns the width needed to display the standard set of buttons on the | 46 // Returns the width needed to display the standard set of buttons on the |
46 // title bar. | 47 // title bar. |
47 static int GetMaxTitleBarButtonWidth(); | 48 static int GetMaxTitleBarButtonWidth(); |
48 | 49 |
49 mus::Window* window() { return window_; } | 50 mus::Window* window() { return window_; } |
50 | 51 |
51 private: | 52 private: |
52 ~NonClientFrameController() override; | 53 ~NonClientFrameController() override; |
53 | 54 |
54 // views::WidgetDelegateView: | 55 // views::WidgetDelegateView: |
55 base::string16 GetWindowTitle() const override; | 56 base::string16 GetWindowTitle() const override; |
56 views::View* GetContentsView() override; | 57 views::View* GetContentsView() override; |
57 bool CanResize() const override; | 58 bool CanResize() const override; |
58 bool CanMaximize() const override; | 59 bool CanMaximize() const override; |
59 bool CanMinimize() const override; | 60 bool CanMinimize() const override; |
60 views::ClientView* CreateClientView(views::Widget* widget) override; | |
61 | 61 |
62 // mus::WindowObserver: | 62 // mus::WindowObserver: |
63 void OnWindowSharedPropertyChanged( | 63 void OnWindowSharedPropertyChanged( |
64 mus::Window* window, | 64 mus::Window* window, |
65 const std::string& name, | 65 const std::string& name, |
66 const std::vector<uint8_t>* old_data, | 66 const std::vector<uint8_t>* old_data, |
67 const std::vector<uint8_t>* new_data) override; | 67 const std::vector<uint8_t>* new_data) override; |
68 void OnWindowDestroyed(mus::Window* window) override; | 68 void OnWindowDestroyed(mus::Window* window) override; |
69 | 69 |
70 views::Widget* widget_; | 70 views::Widget* widget_; |
71 | 71 |
72 // WARNING: as widget delays destruction there is a portion of time when this | 72 // WARNING: as widget delays destruction there is a portion of time when this |
73 // is null. | 73 // is null. |
74 mus::Window* window_; | 74 mus::Window* window_; |
75 | 75 |
76 mus::mojom::WindowTreeHost* mus_window_tree_host_; | 76 mus::mojom::WindowTreeHost* mus_window_tree_host_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); | 78 DISALLOW_COPY_AND_ASSIGN(NonClientFrameController); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace wm | 81 } // namespace muswm |
82 } // namespace mash | 82 } // namespace ash |
83 | 83 |
84 #endif // MASH_WM_NON_CLIENT_FRAME_CONTROLLER_H_ | 84 #endif // ASH_MUS_WM_NON_CLIENT_FRAME_CONTROLLER_H_ |
OLD | NEW |