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 #include "ui/views/mus/window_manager_connection.h" | 5 #include "ui/views/mus/window_manager_connection.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
9 #include "components/mus/public/cpp/window_tree_connection.h" | 9 #include "components/mus/public/cpp/window_tree_connection.h" |
10 #include "components/mus/public/interfaces/window_tree.mojom.h" | 10 #include "components/mus/public/interfaces/window_tree.mojom.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 mus::WindowTreeConnection* window_tree_connection = | 114 mus::WindowTreeConnection* window_tree_connection = |
115 mus::WindowTreeConnection::Create( | 115 mus::WindowTreeConnection::Create( |
116 this, window_tree_client_request.Pass(), | 116 this, window_tree_client_request.Pass(), |
117 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); | 117 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); |
118 DCHECK(window_tree_connection->GetRoot()); | 118 DCHECK(window_tree_connection->GetRoot()); |
119 return window_tree_connection->GetRoot(); | 119 return window_tree_connection->GetRoot(); |
120 } | 120 } |
121 | 121 |
122 WindowManagerConnection::WindowManagerConnection(mojo::ApplicationImpl* app) | 122 WindowManagerConnection::WindowManagerConnection(mojo::ApplicationImpl* app) |
123 : app_(app) { | 123 : app_(app) { |
124 app->ConnectToService(mojo::URLRequest::From(std::string("mojo:mus")), | 124 app->ConnectToService("mojo:mus", &window_manager_); |
125 &window_manager_); | |
126 | 125 |
127 ui_init_.reset(new ui::mojo::UIInit( | 126 ui_init_.reset(new ui::mojo::UIInit( |
128 GetDisplaysFromWindowManager(&window_manager_))); | 127 GetDisplaysFromWindowManager(&window_manager_))); |
129 ViewsDelegate::GetInstance()->set_native_widget_factory( | 128 ViewsDelegate::GetInstance()->set_native_widget_factory( |
130 base::Bind(&WindowManagerConnection::CreateNativeWidget, | 129 base::Bind(&WindowManagerConnection::CreateNativeWidget, |
131 base::Unretained(this))); | 130 base::Unretained(this))); |
132 } | 131 } |
133 | 132 |
134 WindowManagerConnection::~WindowManagerConnection() {} | 133 WindowManagerConnection::~WindowManagerConnection() {} |
135 | 134 |
136 void WindowManagerConnection::OnEmbed(mus::Window* root) {} | 135 void WindowManagerConnection::OnEmbed(mus::Window* root) {} |
137 void WindowManagerConnection::OnConnectionLost( | 136 void WindowManagerConnection::OnConnectionLost( |
138 mus::WindowTreeConnection* connection) {} | 137 mus::WindowTreeConnection* connection) {} |
139 | 138 |
140 NativeWidget* WindowManagerConnection::CreateNativeWidget( | 139 NativeWidget* WindowManagerConnection::CreateNativeWidget( |
141 const Widget::InitParams& init_params, | 140 const Widget::InitParams& init_params, |
142 internal::NativeWidgetDelegate* delegate) { | 141 internal::NativeWidgetDelegate* delegate) { |
143 std::map<std::string, std::vector<uint8_t>> properties; | 142 std::map<std::string, std::vector<uint8_t>> properties; |
144 NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); | 143 NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); |
145 return new NativeWidgetMus(delegate, app_->shell(), NewWindow(properties), | 144 return new NativeWidgetMus(delegate, app_->shell(), NewWindow(properties), |
146 mus::mojom::SURFACE_TYPE_DEFAULT); | 145 mus::mojom::SURFACE_TYPE_DEFAULT); |
147 } | 146 } |
148 | 147 |
149 } // namespace views | 148 } // namespace views |
OLD | NEW |