Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_nacl.h" | 5 #include "ipc/ipc_channel_nacl.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 | 9 |
| 10 // This file is currently a stub to get us linking. | 10 // This file is currently a stub to get us linking. |
| 11 // TODO(brettw) implement this. | 11 // TODO(brettw) implement this. |
| 12 | 12 |
| 13 namespace IPC { | 13 namespace IPC { |
| 14 | 14 |
| 15 ChannelImpl::ChannelImpl(const IPC::ChannelHandle& channel_handle, | 15 Channel::ChannelImpl::ChannelImpl(const IPC::ChannelHandle& channel_handle, |
| 16 Mode mode, | 16 Mode mode, |
| 17 Listener* listener) | 17 Listener* listener) |
| 18 : ChannelReader(listener) { | 18 : ChannelReader(listener) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 ChannelImpl::~ChannelImpl() { | 21 Channel::ChannelImpl::~ChannelImpl() { |
| 22 Close(); | 22 Close(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 bool ChannelImpl::Connect() { | 25 bool Channel::ChannelImpl::Connect() { |
| 26 NOTIMPLEMENTED(); | 26 NOTIMPLEMENTED(); |
| 27 return false; | 27 return false; |
| 28 } | 28 } |
| 29 | 29 |
| 30 void ChannelImpl::Close() { | 30 void Channel::ChannelImpl::Close() { |
| 31 NOTIMPLEMENTED(); | 31 NOTIMPLEMENTED(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool ChannelImpl::Send(Message* message) { | 34 bool Channel::ChannelImpl::Send(Message* message) { |
| 35 NOTIMPLEMENTED(); | 35 NOTIMPLEMENTED(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 int ChannelImpl::GetClientFileDescriptor() const { | 38 int Channel::ChannelImpl::GetClientFileDescriptor() const { |
| 39 NOTIMPLEMENTED(); | 39 NOTIMPLEMENTED(); |
| 40 return -1; | 40 return -1; |
| 41 } | 41 } |
| 42 | 42 |
| 43 int ChannelImpl::TakeClientFileDescriptor() { | 43 int Channel::ChannelImpl::TakeClientFileDescriptor() { |
| 44 NOTIMPLEMENTED(); | 44 NOTIMPLEMENTED(); |
| 45 return -1; | 45 return -1; |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool ChannelImpl::AcceptsConnections() const { | 48 bool Channel::ChannelImpl::AcceptsConnections() const { |
| 49 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool ChannelImpl::HasAcceptedConnection() const { | 53 bool Channel::ChannelImpl::HasAcceptedConnection() const { |
| 54 NOTIMPLEMENTED(); | 54 NOTIMPLEMENTED(); |
| 55 return false; | 55 return false; |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool ChannelImpl::GetClientEuid(uid_t* client_euid) const { | 58 bool Channel::ChannelImpl::GetClientEuid(uid_t* client_euid) const { |
| 59 NOTIMPLEMENTED(); | 59 NOTIMPLEMENTED(); |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void ChannelImpl::ResetToAcceptingConnectionState() { | 63 void Channel::ChannelImpl::ResetToAcceptingConnectionState() { |
| 64 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 Channel::ChannelImpl::ReadState | |
| 68 Channel::ChannelImpl::ReadData(char* buffer, | |
|
brettw
2012/04/23 21:17:35
I think generally we wouldn't indent this second l
| |
| 69 int buffer_len, | |
| 70 int* bytes_read) { | |
| 71 return Channel::ChannelImpl::ReadState(); | |
| 72 } | |
| 73 | |
| 74 bool Channel::ChannelImpl::WillDispatchInputMessage(Message* msg) { | |
| 75 return false; | |
| 76 } | |
| 77 | |
| 78 bool Channel::ChannelImpl::DidEmptyInputBuffers() { | |
| 79 return false; | |
| 80 } | |
| 81 | |
| 82 void Channel::ChannelImpl::HandleHelloMessage(const Message& msg) { | |
| 83 } | |
| 84 | |
| 67 // static | 85 // static |
| 68 bool Channel::ChannelImpl::IsNamedServerInitialized( | 86 bool Channel::ChannelImpl::IsNamedServerInitialized( |
| 69 const std::string& channel_id) { | 87 const std::string& channel_id) { |
| 70 return file_util::PathExists(FilePath(channel_id)); | 88 return false; //file_util::PathExists(FilePath(channel_id)); |
| 71 } | 89 } |
| 72 | 90 |
| 73 //------------------------------------------------------------------------------ | 91 //------------------------------------------------------------------------------ |
| 74 // Channel's methods simply call through to ChannelImpl. | 92 // Channel's methods simply call through to ChannelImpl. |
| 75 | 93 |
| 76 Channel::Channel(const IPC::ChannelHandle& channel_handle, | 94 Channel::Channel(const IPC::ChannelHandle& channel_handle, |
| 77 Mode mode, | 95 Mode mode, |
| 78 Listener* listener) | 96 Listener* listener) |
| 79 : channel_impl_(new ChannelImpl(channel_handle, mode, listener)) { | 97 : channel_impl_(new ChannelImpl(channel_handle, mode, listener)) { |
| 80 } | 98 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 } | 134 } |
| 117 | 135 |
| 118 bool Channel::GetClientEuid(uid_t* client_euid) const { | 136 bool Channel::GetClientEuid(uid_t* client_euid) const { |
| 119 return channel_impl_->GetClientEuid(client_euid); | 137 return channel_impl_->GetClientEuid(client_euid); |
| 120 } | 138 } |
| 121 | 139 |
| 122 void Channel::ResetToAcceptingConnectionState() { | 140 void Channel::ResetToAcceptingConnectionState() { |
| 123 channel_impl_->ResetToAcceptingConnectionState(); | 141 channel_impl_->ResetToAcceptingConnectionState(); |
| 124 } | 142 } |
| 125 | 143 |
| 144 base::ProcessId Channel::peer_pid() const { return 0; } | |
|
brettw
2012/04/23 21:17:35
I'd do multiple lines except for some cases in a c
| |
| 145 | |
| 126 // static | 146 // static |
| 127 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { | 147 bool Channel::IsNamedServerInitialized(const std::string& channel_id) { |
| 128 return ChannelImpl::IsNamedServerInitialized(channel_id); | 148 return ChannelImpl::IsNamedServerInitialized(channel_id); |
| 129 } | 149 } |
| 130 | 150 |
| 131 // static | 151 // static |
| 132 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { | 152 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { |
| 133 // A random name is sufficient validation on posix systems, so we don't need | 153 // A random name is sufficient validation on posix systems, so we don't need |
| 134 // an additional shared secret. | 154 // an additional shared secret. |
| 135 std::string id = prefix; | 155 std::string id = prefix; |
| 136 if (!id.empty()) | 156 if (!id.empty()) |
| 137 id.append("."); | 157 id.append("."); |
| 138 | 158 |
| 139 return id.append(GenerateUniqueRandomChannelID()); | 159 return id.append(GenerateUniqueRandomChannelID()); |
| 140 } | 160 } |
| 141 | 161 |
| 142 } // namespace IPC | 162 } // namespace IPC |
| OLD | NEW |