Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Side by Side Diff: content/browser/mojo/mojo_application_host.cc

Issue 2096643002: Eliminate MojoApplicationHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mah3
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/mojo/mojo_application_host.h"
6
7 #include <utility>
8
9 #include "base/logging.h"
10 #include "build/build_config.h"
11 #include "mojo/edk/embedder/embedder.h"
12
13 namespace content {
14 namespace {
15
16 // TODO(beng): remove this in favor of just using shell APIs directly.
17 // http://crbug.com/2072603002
18 class ApplicationSetupImpl : public mojom::ApplicationSetup {
19 public:
20 ApplicationSetupImpl(ServiceRegistryImpl* service_registry,
21 mojo::InterfaceRequest<mojom::ApplicationSetup> request)
22 : binding_(this, std::move(request)),
23 service_registry_(service_registry) {}
24
25 ~ApplicationSetupImpl() override {
26 }
27
28 private:
29 // mojom::ApplicationSetup implementation.
30 void ExchangeInterfaceProviders(
31 shell::mojom::InterfaceProviderRequest services,
32 shell::mojom::InterfaceProviderPtr exposed_services) override {
33 service_registry_->Bind(std::move(services));
34 mojo::FuseInterface(service_registry_->TakeRemoteRequest(),
35 exposed_services.PassInterface());
36 }
37
38 mojo::Binding<mojom::ApplicationSetup> binding_;
39 ServiceRegistryImpl* service_registry_;
40 };
41
42 } // namespace
43
44 MojoApplicationHost::MojoApplicationHost(const std::string& child_token)
45 : token_(mojo::edk::GenerateRandomToken()) {
46 #if defined(OS_ANDROID)
47 service_registry_android_ =
48 ServiceRegistryAndroid::Create(&service_registry_);
49 #endif
50
51 mojo::ScopedMessagePipeHandle pipe =
52 mojo::edk::CreateParentMessagePipe(token_, child_token);
53 DCHECK(pipe.is_valid());
54 application_setup_.reset(new ApplicationSetupImpl(
55 &service_registry_,
56 mojo::MakeRequest<mojom::ApplicationSetup>(std::move(pipe))));
57 }
58
59 MojoApplicationHost::~MojoApplicationHost() {
60 }
61
62 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_application_host.h ('k') | content/browser/mojo/mojo_child_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698