OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "media/mojo/clients/mojo_android_overlay.h" | 5 #include "media/mojo/clients/mojo_android_overlay.h" |
6 | 6 |
7 #include "services/service_manager/public/cpp/connect.h" | 7 #include "services/service_manager/public/cpp/connect.h" |
8 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" | 8 #include "services/service_manager/public/interfaces/interface_provider.mojom.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
12 MojoAndroidOverlay::MojoAndroidOverlay( | 12 MojoAndroidOverlay::MojoAndroidOverlay( |
13 service_manager::mojom::InterfaceProvider* interface_provider, | 13 service_manager::mojom::InterfaceProvider* interface_provider, |
14 const AndroidOverlay::Config& config) | 14 const AndroidOverlay::Config& config, |
| 15 const base::UnguessableToken& routing_token) |
15 : interface_provider_(interface_provider), config_(config) { | 16 : interface_provider_(interface_provider), config_(config) { |
16 // Connect to the provider service. | 17 // Connect to the provider service. |
17 mojom::AndroidOverlayProviderPtr provider_ptr; | 18 mojom::AndroidOverlayProviderPtr provider_ptr; |
18 service_manager::GetInterface<mojom::AndroidOverlayProvider>( | 19 service_manager::GetInterface<mojom::AndroidOverlayProvider>( |
19 interface_provider_, &provider_ptr_); | 20 interface_provider_, &provider_ptr_); |
20 | 21 |
21 // Fill in details of |config| into |mojo_config|. Our caller could do this | 22 // Fill in details of |config| into |mojo_config|. Our caller could do this |
22 // too, but since we want to retain |config_| anyway, we do it here. | 23 // too, but since we want to retain |config_| anyway, we do it here. |
23 mojom::AndroidOverlayConfigPtr mojo_config = | 24 mojom::AndroidOverlayConfigPtr mojo_config = |
24 mojom::AndroidOverlayConfig::New(); | 25 mojom::AndroidOverlayConfig::New(); |
25 mojo_config->routing_token = config_.routing_token; | 26 mojo_config->routing_token = routing_token; |
26 mojo_config->rect = config_.rect; | 27 mojo_config->rect = config_.rect; |
27 | 28 |
28 mojom::AndroidOverlayClientPtr ptr; | 29 mojom::AndroidOverlayClientPtr ptr; |
29 binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>( | 30 binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>( |
30 this, mojo::MakeRequest(&ptr)); | 31 this, mojo::MakeRequest(&ptr)); |
31 | 32 |
32 provider_ptr_->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr), | 33 provider_ptr_->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr), |
33 std::move(mojo_config)); | 34 std::move(mojo_config)); |
34 } | 35 } |
35 | 36 |
(...skipping 29 matching lines...) Expand all Loading... |
65 if (!received_surface_) | 66 if (!received_surface_) |
66 config_.failed_cb.Run(); | 67 config_.failed_cb.Run(); |
67 else | 68 else |
68 config_.destroyed_cb.Run(); | 69 config_.destroyed_cb.Run(); |
69 | 70 |
70 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to | 71 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to |
71 // signal that we should do that, since it still might be in use. | 72 // signal that we should do that, since it still might be in use. |
72 } | 73 } |
73 | 74 |
74 } // namespace media | 75 } // namespace media |
OLD | NEW |