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 "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "components/mus/public/cpp/window_tree_delegate.h" | 9 #include "components/mus/public/cpp/window_tree_delegate.h" |
10 #include "components/mus/public/interfaces/window_manager.mojom.h" | 10 #include "components/mus/public/interfaces/window_manager.mojom.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 // Establishes a connection to the window manager for use by views within an | 29 // Establishes a connection to the window manager for use by views within an |
30 // application, and performs Aura initialization. | 30 // application, and performs Aura initialization. |
31 class WindowManagerConnection : public mus::WindowTreeDelegate { | 31 class WindowManagerConnection : public mus::WindowTreeDelegate { |
32 public: | 32 public: |
33 static void Create(mus::mojom::WindowManagerPtr window_manager, | 33 static void Create(mus::mojom::WindowManagerPtr window_manager, |
34 mojo::ApplicationImpl* app); | 34 mojo::ApplicationImpl* app); |
35 static WindowManagerConnection* Get(); | 35 static WindowManagerConnection* Get(); |
36 | 36 |
| 37 mojo::ApplicationImpl* app() { return app_; } |
| 38 |
37 mus::Window* NewWindow(const std::map<std::string, | 39 mus::Window* NewWindow(const std::map<std::string, |
38 std::vector<uint8_t>>& properties); | 40 std::vector<uint8_t>>& properties); |
39 | 41 |
40 mus::mojom::WindowManager* window_manager() { | 42 mus::mojom::WindowManager* window_manager() { |
41 return window_manager_.get(); | 43 return window_manager_.get(); |
42 } | 44 } |
43 | 45 |
44 private: | 46 private: |
45 WindowManagerConnection(mus::mojom::WindowManagerPtr window_manager, | 47 WindowManagerConnection(mus::mojom::WindowManagerPtr window_manager, |
46 mojo::ApplicationImpl* app); | 48 mojo::ApplicationImpl* app); |
47 ~WindowManagerConnection() override; | 49 ~WindowManagerConnection() override; |
48 | 50 |
49 // mus::WindowTreeDelegate: | 51 // mus::WindowTreeDelegate: |
50 void OnEmbed(mus::Window* root) override; | 52 void OnEmbed(mus::Window* root) override; |
51 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 53 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
52 | 54 |
53 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params, | 55 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params, |
54 internal::NativeWidgetDelegate* delegate); | 56 internal::NativeWidgetDelegate* delegate); |
55 | 57 |
56 mojo::ApplicationImpl* app_; | 58 mojo::ApplicationImpl* app_; |
57 mus::mojom::WindowManagerPtr window_manager_; | 59 mus::mojom::WindowManagerPtr window_manager_; |
58 scoped_ptr<ui::mojo::UIInit> ui_init_; | 60 scoped_ptr<ui::mojo::UIInit> ui_init_; |
59 | 61 |
60 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 62 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
61 }; | 63 }; |
62 | 64 |
63 } // namespace views | 65 } // namespace views |
64 | 66 |
65 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 67 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
OLD | NEW |