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

Side by Side Diff: content/renderer/mojo/blink_interface_registry_impl.cc

Issue 2401333002: Add a blink InterfaceRegistry. (Closed)
Patch Set: Created 4 years, 2 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 2016 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/renderer/mojo/blink_interface_registry_impl.h"
6
7 #include <utility>
8
9 #include "base/bind.h"
10 #include "mojo/public/cpp/system/message_pipe.h"
11 #include "services/shell/public/cpp/interface_registry.h"
12
13 namespace content {
14 namespace {
15
16 void ForwardToInterfaceFactory(
17 const std::unique_ptr<blink::InterfaceFactory>& factory,
18 mojo::ScopedMessagePipeHandle handle) {
19 factory->onSuccess(std::move(handle));
20 }
21
22 } // namespace
23
24 BlinkInterfaceRegistryImpl::BlinkInterfaceRegistryImpl(
25 base::WeakPtr<shell::InterfaceRegistry> interface_registry)
26 : interface_registry_(interface_registry) {}
27
28 BlinkInterfaceRegistryImpl::~BlinkInterfaceRegistryImpl() = default;
29
30 void BlinkInterfaceRegistryImpl::addInterface(
31 const char* name,
32 std::unique_ptr<blink::InterfaceFactory> factory) {
33 if (!interface_registry_)
34 return;
35
36 interface_registry_->AddInterface(
37 name, base::Bind(&ForwardToInterfaceFactory, std::move(factory)));
38 }
39
40 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698