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