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

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

Issue 2109483002: Remove MojoApplication[Host] & ApplicationSetup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@u2
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
« no previous file with comments | « content/browser/mojo/mojo_application_host.h ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(shell::InterfaceRegistry* interface_registry,
21 shell::InterfaceProvider* remote_interfaces,
22 mojo::InterfaceRequest<mojom::ApplicationSetup> request)
23 : binding_(this, std::move(request)),
24 interface_registry_(interface_registry),
25 remote_interfaces_(remote_interfaces) {
26 shell::mojom::InterfaceProviderPtr remote;
27 pending_interfaces_request_ = GetProxy(&remote);
28 remote_interfaces_->Bind(std::move(remote));
29 }
30
31 ~ApplicationSetupImpl() override {
32 }
33
34 private:
35 // mojom::ApplicationSetup implementation.
36 void ExchangeInterfaceProviders(
37 shell::mojom::InterfaceProviderRequest request,
38 shell::mojom::InterfaceProviderPtr remote_interfaces) override {
39 mojo::FuseInterface(std::move(pending_interfaces_request_),
40 remote_interfaces.PassInterface());
41 interface_registry_->Bind(std::move(request));
42 }
43
44 mojo::Binding<mojom::ApplicationSetup> binding_;
45 shell::InterfaceRegistry* interface_registry_;
46 shell::InterfaceProvider* remote_interfaces_;
47 shell::mojom::InterfaceProviderRequest pending_interfaces_request_;
48 };
49
50 } // namespace
51
52 MojoApplicationHost::MojoApplicationHost(const std::string& child_token)
53 : token_(mojo::edk::GenerateRandomToken()),
54 interface_registry_(new shell::InterfaceRegistry(nullptr)),
55 remote_interfaces_(new shell::InterfaceProvider) {
56 #if defined(OS_ANDROID)
57 service_registry_android_ = ServiceRegistryAndroid::Create(
58 interface_registry_.get(), remote_interfaces_.get());
59 #endif
60
61 mojo::ScopedMessagePipeHandle pipe =
62 mojo::edk::CreateParentMessagePipe(token_, child_token);
63 DCHECK(pipe.is_valid());
64 application_setup_.reset(new ApplicationSetupImpl(
65 interface_registry_.get(),
66 remote_interfaces_.get(),
67 mojo::MakeRequest<mojom::ApplicationSetup>(std::move(pipe))));
68 }
69
70 MojoApplicationHost::~MojoApplicationHost() {
71 }
72
73 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/mojo/mojo_application_host.h ('k') | content/child/child_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698