OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/mojo/mojo_application_host.h" | 5 #include "content/browser/mojo/mojo_application_host.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 service_registry_->Bind(std::move(services)); | 31 service_registry_->Bind(std::move(services)); |
32 service_registry_->BindRemoteServiceProvider(std::move(exposed_services)); | 32 service_registry_->BindRemoteServiceProvider(std::move(exposed_services)); |
33 } | 33 } |
34 | 34 |
35 mojo::Binding<mojom::ApplicationSetup> binding_; | 35 mojo::Binding<mojom::ApplicationSetup> binding_; |
36 ServiceRegistryImpl* service_registry_; | 36 ServiceRegistryImpl* service_registry_; |
37 }; | 37 }; |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 MojoApplicationHost::MojoApplicationHost() | 41 MojoApplicationHost::MojoApplicationHost(const std::string& child_token) |
42 : token_(mojo::edk::GenerateRandomToken()) { | 42 : token_(mojo::edk::GenerateRandomToken()) { |
43 #if defined(OS_ANDROID) | 43 #if defined(OS_ANDROID) |
44 service_registry_android_ = | 44 service_registry_android_ = |
45 ServiceRegistryAndroid::Create(&service_registry_); | 45 ServiceRegistryAndroid::Create(&service_registry_); |
46 #endif | 46 #endif |
47 | 47 |
48 mojo::ScopedMessagePipeHandle pipe = | 48 mojo::ScopedMessagePipeHandle pipe = |
49 mojo::edk::CreateParentMessagePipe(token_); | 49 mojo::edk::CreateParentMessagePipe(token_, child_token); |
50 DCHECK(pipe.is_valid()); | 50 DCHECK(pipe.is_valid()); |
51 application_setup_.reset(new ApplicationSetupImpl( | 51 application_setup_.reset(new ApplicationSetupImpl( |
52 &service_registry_, | 52 &service_registry_, |
53 mojo::MakeRequest<mojom::ApplicationSetup>(std::move(pipe)))); | 53 mojo::MakeRequest<mojom::ApplicationSetup>(std::move(pipe)))); |
54 } | 54 } |
55 | 55 |
56 MojoApplicationHost::~MojoApplicationHost() { | 56 MojoApplicationHost::~MojoApplicationHost() { |
57 } | 57 } |
58 | 58 |
59 } // namespace content | 59 } // namespace content |
OLD | NEW |