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 <utility> |
| 8 |
7 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
9 #include "base/threading/thread_restrictions.h" | 11 #include "base/threading/thread_restrictions.h" |
10 #include "components/mus/public/cpp/window_tree_connection.h" | 12 #include "components/mus/public/cpp/window_tree_connection.h" |
11 #include "components/mus/public/interfaces/window_tree.mojom.h" | 13 #include "components/mus/public/interfaces/window_tree.mojom.h" |
12 #include "mojo/application/public/cpp/application_connection.h" | 14 #include "mojo/application/public/cpp/application_connection.h" |
13 #include "mojo/application/public/cpp/application_impl.h" | 15 #include "mojo/application/public/cpp/application_impl.h" |
14 #include "mojo/converters/geometry/geometry_type_converters.h" | 16 #include "mojo/converters/geometry/geometry_type_converters.h" |
15 #include "mojo/converters/network/network_type_converters.h" | 17 #include "mojo/converters/network/network_type_converters.h" |
16 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 DCHECK(connection); | 107 DCHECK(connection); |
106 return connection; | 108 return connection; |
107 } | 109 } |
108 | 110 |
109 mus::Window* WindowManagerConnection::NewWindow( | 111 mus::Window* WindowManagerConnection::NewWindow( |
110 const std::map<std::string, std::vector<uint8_t>>& properties) { | 112 const std::map<std::string, std::vector<uint8_t>>& properties) { |
111 mus::mojom::WindowTreeClientPtr window_tree_client; | 113 mus::mojom::WindowTreeClientPtr window_tree_client; |
112 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> | 114 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> |
113 window_tree_client_request = GetProxy(&window_tree_client); | 115 window_tree_client_request = GetProxy(&window_tree_client); |
114 window_manager_->OpenWindow( | 116 window_manager_->OpenWindow( |
115 window_tree_client.Pass(), | 117 std::move(window_tree_client), |
116 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(properties)); | 118 mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(properties)); |
117 | 119 |
118 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 120 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
119 mus::WindowTreeConnection* window_tree_connection = | 121 mus::WindowTreeConnection* window_tree_connection = |
120 mus::WindowTreeConnection::Create( | 122 mus::WindowTreeConnection::Create( |
121 this, window_tree_client_request.Pass(), | 123 this, std::move(window_tree_client_request), |
122 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); | 124 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); |
123 DCHECK(window_tree_connection->GetRoot()); | 125 DCHECK(window_tree_connection->GetRoot()); |
124 return window_tree_connection->GetRoot(); | 126 return window_tree_connection->GetRoot(); |
125 } | 127 } |
126 | 128 |
127 WindowManagerConnection::WindowManagerConnection(mojo::ApplicationImpl* app) | 129 WindowManagerConnection::WindowManagerConnection(mojo::ApplicationImpl* app) |
128 : app_(app) { | 130 : app_(app) { |
129 app->ConnectToService("mojo:mus", &window_manager_); | 131 app->ConnectToService("mojo:mus", &window_manager_); |
130 | 132 |
131 ui_init_.reset(new ui::mojo::UIInit( | 133 ui_init_.reset(new ui::mojo::UIInit( |
(...skipping 12 matching lines...) Expand all Loading... |
144 NativeWidget* WindowManagerConnection::CreateNativeWidget( | 146 NativeWidget* WindowManagerConnection::CreateNativeWidget( |
145 const Widget::InitParams& init_params, | 147 const Widget::InitParams& init_params, |
146 internal::NativeWidgetDelegate* delegate) { | 148 internal::NativeWidgetDelegate* delegate) { |
147 std::map<std::string, std::vector<uint8_t>> properties; | 149 std::map<std::string, std::vector<uint8_t>> properties; |
148 NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); | 150 NativeWidgetMus::ConfigurePropertiesForNewWindow(init_params, &properties); |
149 return new NativeWidgetMus(delegate, app_->shell(), NewWindow(properties), | 151 return new NativeWidgetMus(delegate, app_->shell(), NewWindow(properties), |
150 mus::mojom::SURFACE_TYPE_DEFAULT); | 152 mus::mojom::SURFACE_TYPE_DEFAULT); |
151 } | 153 } |
152 | 154 |
153 } // namespace views | 155 } // namespace views |
OLD | NEW |