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 UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 5 #ifndef UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
6 #define UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 6 #define UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // WindowManagerConnection is a singleton and should be created early on. | 33 // WindowManagerConnection is a singleton and should be created early on. |
34 // | 34 // |
35 // TODO(sky): this name is now totally confusing. Come up with a better one. | 35 // TODO(sky): this name is now totally confusing. Come up with a better one. |
36 class VIEWS_MUS_EXPORT WindowManagerConnection | 36 class VIEWS_MUS_EXPORT WindowManagerConnection |
37 : public NON_EXPORTED_BASE(mus::WindowTreeDelegate), | 37 : public NON_EXPORTED_BASE(mus::WindowTreeDelegate), |
38 public ScreenMusDelegate { | 38 public ScreenMusDelegate { |
39 public: | 39 public: |
40 static void Create(mojo::Shell* shell); | 40 static void Create(mojo::Shell* shell); |
41 static WindowManagerConnection* Get(); | 41 static WindowManagerConnection* Get(); |
42 | 42 |
| 43 // Destroys the singleton instance. |
| 44 static void Reset(); |
| 45 |
43 mojo::Shell* shell() { return shell_; } | 46 mojo::Shell* shell() { return shell_; } |
44 | 47 |
45 mus::Window* NewWindow(const std::map<std::string, | 48 mus::Window* NewWindow(const std::map<std::string, |
46 std::vector<uint8_t>>& properties); | 49 std::vector<uint8_t>>& properties); |
47 | 50 |
48 private: | 51 private: |
49 explicit WindowManagerConnection(mojo::Shell* shell); | 52 explicit WindowManagerConnection(mojo::Shell* shell); |
50 ~WindowManagerConnection() override; | 53 ~WindowManagerConnection() override; |
51 | 54 |
52 // mus::WindowTreeDelegate: | 55 // mus::WindowTreeDelegate: |
53 void OnEmbed(mus::Window* root) override; | 56 void OnEmbed(mus::Window* root) override; |
54 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 57 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
55 | 58 |
56 // ScreenMusDelegate: | 59 // ScreenMusDelegate: |
57 void OnWindowManagerFrameValuesChanged() override; | 60 void OnWindowManagerFrameValuesChanged() override; |
58 | 61 |
59 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params, | 62 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params, |
60 internal::NativeWidgetDelegate* delegate); | 63 internal::NativeWidgetDelegate* delegate); |
61 | 64 |
62 mojo::Shell* shell_; | 65 mojo::Shell* shell_; |
63 scoped_ptr<ScreenMus> screen_; | 66 scoped_ptr<ScreenMus> screen_; |
64 scoped_ptr<mus::WindowTreeConnection> window_tree_connection_; | 67 scoped_ptr<mus::WindowTreeConnection> window_tree_connection_; |
65 | 68 |
66 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 69 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
67 }; | 70 }; |
68 | 71 |
69 } // namespace views | 72 } // namespace views |
70 | 73 |
71 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 74 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
OLD | NEW |