| 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 "ipc/ipc_channel_factory.h" | 5 #include "ipc/ipc_channel_factory.h" |
| 6 | 6 |
| 7 namespace IPC { | 7 namespace IPC { |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 class PlatformChannelFactory : public ChannelFactory { | 11 class PlatformChannelFactory : public ChannelFactory { |
| 12 public: | 12 public: |
| 13 PlatformChannelFactory(ChannelHandle handle, | 13 PlatformChannelFactory(ChannelHandle handle, Channel::Mode mode) |
| 14 Channel::Mode mode, | 14 : handle_(handle), mode_(mode) {} |
| 15 AttachmentBroker* broker) | |
| 16 : handle_(handle), mode_(mode), broker_(broker) {} | |
| 17 | 15 |
| 18 std::string GetName() const override { | 16 std::string GetName() const override { |
| 19 return handle_.name; | 17 return handle_.name; |
| 20 } | 18 } |
| 21 | 19 |
| 22 scoped_ptr<Channel> BuildChannel(Listener* listener) override { | 20 scoped_ptr<Channel> BuildChannel(Listener* listener) override { |
| 23 return Channel::Create(handle_, mode_, listener, broker_); | 21 return Channel::Create(handle_, mode_, listener); |
| 24 } | 22 } |
| 25 | 23 |
| 26 private: | 24 private: |
| 27 ChannelHandle handle_; | 25 ChannelHandle handle_; |
| 28 Channel::Mode mode_; | 26 Channel::Mode mode_; |
| 29 AttachmentBroker* broker_; | |
| 30 | 27 |
| 31 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory); | 28 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory); |
| 32 }; | 29 }; |
| 33 | 30 |
| 34 } // namespace | 31 } // namespace |
| 35 | 32 |
| 36 // static | 33 // static |
| 37 scoped_ptr<ChannelFactory> ChannelFactory::Create(const ChannelHandle& handle, | 34 scoped_ptr<ChannelFactory> ChannelFactory::Create(const ChannelHandle& handle, |
| 38 Channel::Mode mode, | 35 Channel::Mode mode) { |
| 39 AttachmentBroker* broker) { | 36 return scoped_ptr<ChannelFactory>(new PlatformChannelFactory(handle, mode)); |
| 40 return scoped_ptr<ChannelFactory>( | |
| 41 new PlatformChannelFactory(handle, mode, broker)); | |
| 42 } | 37 } |
| 43 | 38 |
| 44 } // namespace IPC | 39 } // namespace IPC |
| OLD | NEW |