Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: ui/views/mus/window_manager_connection.h

Issue 1725353003: Eliminate mojo::Shell client lib class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@15connector
Patch Set: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 Shell; 18 class Connector;
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::Shell* shell); 40 static void Create(mojo::Connector* connector);
41 static WindowManagerConnection* Get(); 41 static WindowManagerConnection* Get();
42 42
43 // Destroys the singleton instance. 43 // Destroys the singleton instance.
44 static void Reset(); 44 static void Reset();
45 45
46 mojo::Shell* shell() { return shell_; } 46 mojo::Connector* connector() { return connector_; }
47 47
48 mus::Window* NewWindow(const std::map<std::string, 48 mus::Window* NewWindow(const std::map<std::string,
49 std::vector<uint8_t>>& properties); 49 std::vector<uint8_t>>& properties);
50 50
51 NativeWidget* CreateNativeWidgetMus( 51 NativeWidget* CreateNativeWidgetMus(
52 const std::map<std::string, std::vector<uint8_t>>& properties, 52 const std::map<std::string, std::vector<uint8_t>>& properties,
53 const Widget::InitParams& init_params, 53 const Widget::InitParams& init_params,
54 internal::NativeWidgetDelegate* delegate); 54 internal::NativeWidgetDelegate* delegate);
55 55
56 private: 56 private:
57 explicit WindowManagerConnection(mojo::Shell* shell); 57 explicit WindowManagerConnection(mojo::Connector* connector);
58 ~WindowManagerConnection() override; 58 ~WindowManagerConnection() override;
59 59
60 // mus::WindowTreeDelegate: 60 // mus::WindowTreeDelegate:
61 void OnEmbed(mus::Window* root) override; 61 void OnEmbed(mus::Window* root) override;
62 void OnConnectionLost(mus::WindowTreeConnection* connection) override; 62 void OnConnectionLost(mus::WindowTreeConnection* connection) override;
63 63
64 // ScreenMusDelegate: 64 // ScreenMusDelegate:
65 void OnWindowManagerFrameValuesChanged() override; 65 void OnWindowManagerFrameValuesChanged() override;
66 66
67 67
68 mojo::Shell* shell_; 68 mojo::Connector* connector_;
69 scoped_ptr<ScreenMus> screen_; 69 scoped_ptr<ScreenMus> screen_;
70 scoped_ptr<mus::WindowTreeConnection> window_tree_connection_; 70 scoped_ptr<mus::WindowTreeConnection> window_tree_connection_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); 72 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection);
73 }; 73 };
74 74
75 } // namespace views 75 } // namespace views
76 76
77 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ 77 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698