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 const base::UnguessableToken& routing_token) |
16 : interface_provider_(interface_provider), config_(config) { | 16 : interface_provider_(interface_provider), config_(config) { |
17 // Connect to the provider service. | 17 // Connect to the provider service. |
18 mojom::AndroidOverlayProviderPtr provider_ptr; | 18 mojom::AndroidOverlayProviderPtr provider_ptr; |
19 service_manager::GetInterface<mojom::AndroidOverlayProvider>( | 19 service_manager::GetInterface<mojom::AndroidOverlayProvider>( |
20 interface_provider_, &provider_ptr_); | 20 interface_provider_, &provider_ptr_); |
21 | 21 |
22 // 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 |
23 // 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. |
24 mojom::AndroidOverlayConfigPtr mojo_config = | 24 mojom::AndroidOverlayConfigPtr mojo_config = |
25 mojom::AndroidOverlayConfig::New(); | 25 mojom::AndroidOverlayConfig::New(); |
26 mojo_config->routing_token = routing_token; | 26 mojo_config->routing_token = routing_token; |
27 mojo_config->rect = config_.rect; | 27 mojo_config->rect = config_.rect; |
| 28 mojo_config->secure = config_.secure; |
28 | 29 |
29 mojom::AndroidOverlayClientPtr ptr; | 30 mojom::AndroidOverlayClientPtr ptr; |
30 binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>( | 31 binding_ = base::MakeUnique<mojo::Binding<mojom::AndroidOverlayClient>>( |
31 this, mojo::MakeRequest(&ptr)); | 32 this, mojo::MakeRequest(&ptr)); |
32 | 33 |
33 provider_ptr_->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr), | 34 provider_ptr_->CreateOverlay(mojo::MakeRequest(&overlay_ptr_), std::move(ptr), |
34 std::move(mojo_config)); | 35 std::move(mojo_config)); |
35 } | 36 } |
36 | 37 |
37 MojoAndroidOverlay::~MojoAndroidOverlay() { | 38 MojoAndroidOverlay::~MojoAndroidOverlay() { |
(...skipping 28 matching lines...) Expand all Loading... |
66 if (!received_surface_) | 67 if (!received_surface_) |
67 config_.failed_cb.Run(this); | 68 config_.failed_cb.Run(this); |
68 else | 69 else |
69 config_.destroyed_cb.Run(this); | 70 config_.destroyed_cb.Run(this); |
70 | 71 |
71 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to | 72 // Note: we do not delete |overlay_ptr_| here. Our client must delete us to |
72 // signal that we should do that, since it still might be in use. | 73 // signal that we should do that, since it still might be in use. |
73 } | 74 } |
74 | 75 |
75 } // namespace media | 76 } // namespace media |
OLD | NEW |