Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / ipc / ipc_channel_factory.cc
blobac050855cfcf37fe7ce679aaf1a21c6eb0835eb9
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.
5 #include "ipc/ipc_channel_factory.h"
7 namespace IPC {
9 namespace {
11 class PlatformChannelFactory : public ChannelFactory {
12 public:
13 PlatformChannelFactory(ChannelHandle handle,
14 Channel::Mode mode,
15 AttachmentBroker* broker)
16 : handle_(handle), mode_(mode), broker_(broker) {}
18 std::string GetName() const override {
19 return handle_.name;
22 scoped_ptr<Channel> BuildChannel(Listener* listener) override {
23 return Channel::Create(handle_, mode_, listener, broker_);
26 private:
27 ChannelHandle handle_;
28 Channel::Mode mode_;
29 AttachmentBroker* broker_;
31 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory);
34 } // namespace
36 // static
37 scoped_ptr<ChannelFactory> ChannelFactory::Create(const ChannelHandle& handle,
38 Channel::Mode mode,
39 AttachmentBroker* broker) {
40 return scoped_ptr<ChannelFactory>(
41 new PlatformChannelFactory(handle, mode, broker));
44 } // namespace IPC