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