| 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, |
| 14 Channel::Mode mode) | 14 Channel::Mode mode) |
| 15 : handle_(handle), mode_(mode) { | 15 : handle_(handle), mode_(mode) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 virtual std::string GetName() const override { | 18 std::string GetName() const override { |
| 19 return handle_.name; | 19 return handle_.name; |
| 20 } | 20 } |
| 21 | 21 |
| 22 virtual scoped_ptr<Channel> BuildChannel( | 22 scoped_ptr<Channel> BuildChannel(Listener* listener) override { |
| 23 Listener* listener) override { | |
| 24 return Channel::Create(handle_, mode_, listener); | 23 return Channel::Create(handle_, mode_, listener); |
| 25 } | 24 } |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 ChannelHandle handle_; | 27 ChannelHandle handle_; |
| 29 Channel::Mode mode_; | 28 Channel::Mode mode_; |
| 30 | 29 |
| 31 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory); | 30 DISALLOW_COPY_AND_ASSIGN(PlatformChannelFactory); |
| 32 }; | 31 }; |
| 33 | 32 |
| 34 } // namespace | 33 } // namespace |
| 35 | 34 |
| 36 // static | 35 // static |
| 37 scoped_ptr<ChannelFactory> ChannelFactory::Create( | 36 scoped_ptr<ChannelFactory> ChannelFactory::Create( |
| 38 const ChannelHandle& handle, Channel::Mode mode) { | 37 const ChannelHandle& handle, Channel::Mode mode) { |
| 39 return scoped_ptr<ChannelFactory>(new PlatformChannelFactory(handle, mode)); | 38 return scoped_ptr<ChannelFactory>(new PlatformChannelFactory(handle, mode)); |
| 40 } | 39 } |
| 41 | 40 |
| 42 } // namespace IPC | 41 } // namespace IPC |
| OLD | NEW |