| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "components/mus/public/cpp/window_tree_delegate.h" | 12 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 13 #include "ui/views/mus/mus_export.h" | 13 #include "ui/views/mus/mus_export.h" |
| 14 #include "ui/views/mus/screen_mus_delegate.h" | 14 #include "ui/views/mus/screen_mus_delegate.h" |
| 15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 class ApplicationImpl; | 18 class Shell; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class NativeWidget; | 22 class NativeWidget; |
| 23 class ScreenMus; | 23 class ScreenMus; |
| 24 namespace internal { | 24 namespace internal { |
| 25 class NativeWidgetDelegate; | 25 class NativeWidgetDelegate; |
| 26 } | 26 } |
| 27 | 27 |
| 28 // Provides configuration to mus in views. This consists of the following: | 28 // Provides configuration to mus in views. This consists of the following: |
| 29 // . Provides a Screen implementation backed by mus. | 29 // . Provides a Screen implementation backed by mus. |
| 30 // . Creates and owns a WindowTreeConnection. | 30 // . Creates and owns a WindowTreeConnection. |
| 31 // . Registers itself as the factory for creating NativeWidgets so that a | 31 // . Registers itself as the factory for creating NativeWidgets so that a |
| 32 // NativeWidgetMus is created. | 32 // NativeWidgetMus is created. |
| 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::ApplicationImpl* app); | 40 static void Create(mojo::Shell* shell); |
| 41 static WindowManagerConnection* Get(); | 41 static WindowManagerConnection* Get(); |
| 42 | 42 |
| 43 mojo::ApplicationImpl* app() { return app_; } | 43 mojo::Shell* shell() { return shell_; } |
| 44 | 44 |
| 45 mus::Window* NewWindow(const std::map<std::string, | 45 mus::Window* NewWindow(const std::map<std::string, |
| 46 std::vector<uint8_t>>& properties); | 46 std::vector<uint8_t>>& properties); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 explicit WindowManagerConnection(mojo::ApplicationImpl* app); | 49 explicit WindowManagerConnection(mojo::Shell* shell); |
| 50 ~WindowManagerConnection() override; | 50 ~WindowManagerConnection() override; |
| 51 | 51 |
| 52 // mus::WindowTreeDelegate: | 52 // mus::WindowTreeDelegate: |
| 53 void OnEmbed(mus::Window* root) override; | 53 void OnEmbed(mus::Window* root) override; |
| 54 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 54 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
| 55 | 55 |
| 56 // ScreenMusDelegate: | 56 // ScreenMusDelegate: |
| 57 void OnWindowManagerFrameValuesChanged() override; | 57 void OnWindowManagerFrameValuesChanged() override; |
| 58 | 58 |
| 59 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params, | 59 NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params, |
| 60 internal::NativeWidgetDelegate* delegate); | 60 internal::NativeWidgetDelegate* delegate); |
| 61 | 61 |
| 62 mojo::ApplicationImpl* app_; | 62 mojo::Shell* shell_; |
| 63 scoped_ptr<ScreenMus> screen_; | 63 scoped_ptr<ScreenMus> screen_; |
| 64 scoped_ptr<mus::WindowTreeConnection> window_tree_connection_; | 64 scoped_ptr<mus::WindowTreeConnection> window_tree_connection_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 66 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace views | 69 } // namespace views |
| 70 | 70 |
| 71 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 71 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
| OLD | NEW |