| 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/surface_binding.h" | 5 #include "ui/views/mus/surface_binding.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "mojo/converters/geometry/geometry_type_converters.h" | 26 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 27 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 27 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
| 28 #include "mojo/public/cpp/bindings/binding.h" | 28 #include "mojo/public/cpp/bindings/binding.h" |
| 29 #include "mojo/shell/public/cpp/application_impl.h" | 29 #include "mojo/shell/public/cpp/application_impl.h" |
| 30 #include "mojo/shell/public/cpp/connect.h" | 30 #include "mojo/shell/public/cpp/connect.h" |
| 31 #include "mojo/shell/public/interfaces/shell.mojom.h" | 31 #include "mojo/shell/public/interfaces/shell.mojom.h" |
| 32 #include "ui/views/mus/window_tree_host_mus.h" | 32 #include "ui/views/mus/window_tree_host_mus.h" |
| 33 | 33 |
| 34 namespace views { | 34 namespace views { |
| 35 namespace { | 35 namespace { |
| 36 void OnGotContentHandlerID(uint32_t content_handler_id) {} | 36 void OnGotRemoteIDs(uint32_t remote_id, uint32_t content_handler_id) {} |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 // PerConnectionState ---------------------------------------------------------- | 39 // PerConnectionState ---------------------------------------------------------- |
| 40 | 40 |
| 41 // State needed per ViewManager. Provides the real implementation of | 41 // State needed per ViewManager. Provides the real implementation of |
| 42 // CreateOutputSurface. SurfaceBinding obtains a pointer to the | 42 // CreateOutputSurface. SurfaceBinding obtains a pointer to the |
| 43 // PerConnectionState appropriate for the ViewManager. PerConnectionState is | 43 // PerConnectionState appropriate for the ViewManager. PerConnectionState is |
| 44 // stored in a thread local map. When no more refereces to a PerConnectionState | 44 // stored in a thread local map. When no more refereces to a PerConnectionState |
| 45 // remain the PerConnectionState is deleted and the underlying map cleaned up. | 45 // remain the PerConnectionState is deleted and the underlying map cleaned up. |
| 46 class SurfaceBinding::PerConnectionState | 46 class SurfaceBinding::PerConnectionState |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 | 130 |
| 131 void SurfaceBinding::PerConnectionState::Init() { | 131 void SurfaceBinding::PerConnectionState::Init() { |
| 132 mojo::ServiceProviderPtr service_provider; | 132 mojo::ServiceProviderPtr service_provider; |
| 133 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 133 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 134 request->url = mojo::String::From("mojo:mus"); | 134 request->url = mojo::String::From("mojo:mus"); |
| 135 shell_->ConnectToApplication(std::move(request), GetProxy(&service_provider), | 135 shell_->ConnectToApplication(std::move(request), GetProxy(&service_provider), |
| 136 nullptr, | 136 nullptr, |
| 137 mojo::CreatePermissiveCapabilityFilter(), | 137 mojo::CreatePermissiveCapabilityFilter(), |
| 138 base::Bind(&OnGotContentHandlerID)); | 138 base::Bind(&OnGotRemoteIDs)); |
| 139 ConnectToService(service_provider.get(), &gpu_); | 139 ConnectToService(service_provider.get(), &gpu_); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // SurfaceBinding -------------------------------------------------------------- | 142 // SurfaceBinding -------------------------------------------------------------- |
| 143 | 143 |
| 144 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, | 144 SurfaceBinding::SurfaceBinding(mojo::Shell* shell, |
| 145 mus::Window* window, | 145 mus::Window* window, |
| 146 mus::mojom::SurfaceType surface_type) | 146 mus::mojom::SurfaceType surface_type) |
| 147 : window_(window), | 147 : window_(window), |
| 148 surface_type_(surface_type), | 148 surface_type_(surface_type), |
| 149 state_(PerConnectionState::Get(shell, window->connection())) {} | 149 state_(PerConnectionState::Get(shell, window->connection())) {} |
| 150 | 150 |
| 151 SurfaceBinding::~SurfaceBinding() {} | 151 SurfaceBinding::~SurfaceBinding() {} |
| 152 | 152 |
| 153 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { | 153 scoped_ptr<cc::OutputSurface> SurfaceBinding::CreateOutputSurface() { |
| 154 return state_->CreateOutputSurface(window_, surface_type_); | 154 return state_->CreateOutputSurface(window_, surface_type_); |
| 155 } | 155 } |
| 156 | 156 |
| 157 } // namespace views | 157 } // namespace views |
| OLD | NEW |