diff options
author | erikchen <erikchen@chromium.org> | 2015-07-28 16:25:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-28 23:26:31 +0000 |
commit | 484c0084e981f9bb1e43757ae2686dd4e8c6205d (patch) | |
tree | a4e69b7978aca54a3e62f0751179702c967eae1f /ipc | |
parent | 8acd84d5ea91a2f23e3124f0be69f4f3bf024767 (diff) | |
download | chromium_src-484c0084e981f9bb1e43757ae2686dd4e8c6205d.zip chromium_src-484c0084e981f9bb1e43757ae2686dd4e8c6205d.tar.gz chromium_src-484c0084e981f9bb1e43757ae2686dd4e8c6205d.tar.bz2 |
ipc: Create AttachmentBrokerPrivileged and AttachmentBrokerUnprivileged.
This CL is a refactor and contains no behavior changes.
AttachmentBroker is an abstract base class. I made two new abstract subclasses,
AttachmentBrokerPrivileged and AttachmentBrokerUnprivileged for use in
privileged and unprivileged processes respectively. These in turn are inherited
by AttachmentBrokerPrivilegedWin and AttachmentBrokerUnprivilegedWin.
BUG=493414
TBR=avi@chromium.org
Review URL: https://codereview.chromium.org/1256993003
Cr-Commit-Position: refs/heads/master@{#340803}
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/BUILD.gn | 10 | ||||
-rw-r--r-- | ipc/attachment_broker.h | 6 | ||||
-rw-r--r-- | ipc/attachment_broker_privileged.cc | 40 | ||||
-rw-r--r-- | ipc/attachment_broker_privileged.h | 44 | ||||
-rw-r--r-- | ipc/attachment_broker_privileged_win.cc | 23 | ||||
-rw-r--r-- | ipc/attachment_broker_privileged_win.h | 23 | ||||
-rw-r--r-- | ipc/attachment_broker_privileged_win_unittest.cc | 16 | ||||
-rw-r--r-- | ipc/attachment_broker_unprivileged.cc | 13 | ||||
-rw-r--r-- | ipc/attachment_broker_unprivileged.h | 36 | ||||
-rw-r--r-- | ipc/attachment_broker_unprivileged_win.cc (renamed from ipc/attachment_broker_win.cc) | 19 | ||||
-rw-r--r-- | ipc/attachment_broker_unprivileged_win.h (renamed from ipc/attachment_broker_win.h) | 30 | ||||
-rw-r--r-- | ipc/attachment_broker_unprivileged_win_unittest.cc (renamed from ipc/attachment_broker_win_unittest.cc) | 10 | ||||
-rw-r--r-- | ipc/ipc.gyp | 2 | ||||
-rw-r--r-- | ipc/ipc.gypi | 8 |
14 files changed, 193 insertions, 87 deletions
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn index 75d0c62..c56559f 100644 --- a/ipc/BUILD.gn +++ b/ipc/BUILD.gn @@ -9,10 +9,14 @@ component("ipc") { "attachment_broker.cc", "attachment_broker.h", "attachment_broker_messages.h", + "attachment_broker_privileged.cc", + "attachment_broker_privileged.h", "attachment_broker_privileged_win.cc", "attachment_broker_privileged_win.h", - "attachment_broker_win.cc", - "attachment_broker_win.h", + "attachment_broker_unprivileged.cc", + "attachment_broker_unprivileged.h", + "attachment_broker_unprivileged_win.cc", + "attachment_broker_unprivileged_win.h", "brokerable_attachment.cc", "brokerable_attachment.h", "handle_attachment_win.cc", @@ -120,7 +124,7 @@ if (!is_android) { test("ipc_tests") { sources = [ "attachment_broker_privileged_win_unittest.cc", - "attachment_broker_win_unittest.cc", + "attachment_broker_unprivileged_win_unittest.cc", "ipc_channel_posix_unittest.cc", "ipc_channel_reader_unittest.cc", "ipc_channel_unittest.cc", diff --git a/ipc/attachment_broker.h b/ipc/attachment_broker.h index 9bd6114..5b65289 100644 --- a/ipc/attachment_broker.h +++ b/ipc/attachment_broker.h @@ -84,8 +84,10 @@ class IPC_EXPORT AttachmentBroker : public Listener { private: #if defined(OS_WIN) - FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerWinTest, ReceiveValidMessage); - FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerWinTest, ReceiveInvalidMessage); + FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerUnprivilegedWinTest, + ReceiveValidMessage); + FRIEND_TEST_ALL_PREFIXES(AttachmentBrokerUnprivilegedWinTest, + ReceiveInvalidMessage); #endif // defined(OS_WIN) // A vector of BrokerableAttachments that have been received, but not yet diff --git a/ipc/attachment_broker_privileged.cc b/ipc/attachment_broker_privileged.cc new file mode 100644 index 0000000..d2b6832 --- /dev/null +++ b/ipc/attachment_broker_privileged.cc @@ -0,0 +1,40 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ipc/attachment_broker_privileged.h" + +#include <algorithm> + +#include "ipc/ipc_channel.h" + +namespace IPC { + +AttachmentBrokerPrivileged::AttachmentBrokerPrivileged() {} + +AttachmentBrokerPrivileged::~AttachmentBrokerPrivileged() {} + +void AttachmentBrokerPrivileged::RegisterCommunicationChannel( + Channel* channel) { + auto it = std::find(channels_.begin(), channels_.end(), channel); + DCHECK(channels_.end() == it); + channels_.push_back(channel); +} + +void AttachmentBrokerPrivileged::DeregisterCommunicationChannel( + Channel* channel) { + auto it = std::find(channels_.begin(), channels_.end(), channel); + if (it != channels_.end()) + channels_.erase(it); +} + +Channel* AttachmentBrokerPrivileged::GetChannelWithProcessId( + base::ProcessId id) { + auto it = std::find_if(channels_.begin(), channels_.end(), + [id](Channel* c) { return c->GetPeerPID() == id; }); + if (it == channels_.end()) + return nullptr; + return *it; +} + +} // namespace IPC diff --git a/ipc/attachment_broker_privileged.h b/ipc/attachment_broker_privileged.h new file mode 100644 index 0000000..52befc4 --- /dev/null +++ b/ipc/attachment_broker_privileged.h @@ -0,0 +1,44 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ +#define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ + +#include <vector> + +#include "ipc/attachment_broker.h" +#include "ipc/ipc_export.h" + +namespace IPC { + +class Channel; + +// This abstract subclass of AttachmentBroker is intended for use in a +// privileged process . When unprivileged processes want to send attachments, +// the attachments get routed through the privileged process, and more +// specifically, an instance of this class. +class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker { + public: + AttachmentBrokerPrivileged(); + ~AttachmentBrokerPrivileged() override; + + // Each unprivileged process should have one IPC channel on which it + // communicates attachment information with the broker process. In the broker + // process, these channels must be registered and deregistered with the + // Attachment Broker as they are created and destroyed. + void RegisterCommunicationChannel(Channel* channel); + void DeregisterCommunicationChannel(Channel* channel); + + protected: + // Returns nullptr if no channel is found. + Channel* GetChannelWithProcessId(base::ProcessId id); + + private: + std::vector<Channel*> channels_; + DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); +}; + +} // namespace IPC + +#endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ diff --git a/ipc/attachment_broker_privileged_win.cc b/ipc/attachment_broker_privileged_win.cc index 965f3b4..5344e20 100644 --- a/ipc/attachment_broker_privileged_win.cc +++ b/ipc/attachment_broker_privileged_win.cc @@ -47,20 +47,6 @@ bool AttachmentBrokerPrivilegedWin::OnMessageReceived(const Message& msg) { return handled; } -void AttachmentBrokerPrivilegedWin::RegisterCommunicationChannel( - Channel* channel) { - auto it = std::find(channels_.begin(), channels_.end(), channel); - DCHECK(channels_.end() == it); - channels_.push_back(channel); -} - -void AttachmentBrokerPrivilegedWin::DeregisterCommunicationChannel( - Channel* channel) { - auto it = std::find(channels_.begin(), channels_.end(), channel); - DCHECK(it != channels_.end()); - channels_.erase(it); -} - void AttachmentBrokerPrivilegedWin::OnDuplicateWinHandle( const IPC::Message& message) { AttachmentBrokerMsg_DuplicateWinHandle::Param param; @@ -89,10 +75,8 @@ void AttachmentBrokerPrivilegedWin::RouteDuplicatedHandle( // Another process is the destination. base::ProcessId dest = wire_format.destination_process; - auto it = - std::find_if(channels_.begin(), channels_.end(), - [dest](Channel* c) { return c->GetPeerPID() == dest; }); - if (it == channels_.end()) { + Channel* channel = GetChannelWithProcessId(dest); + if (!channel) { // Assuming that this message was not sent from a malicious process, the // channel endpoint that would have received this message will block // forever. @@ -101,7 +85,8 @@ void AttachmentBrokerPrivilegedWin::RouteDuplicatedHandle( return; } - (*it)->Send(new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format)); + channel->Send( + new AttachmentBrokerMsg_WinHandleHasBeenDuplicated(wire_format)); } AttachmentBrokerPrivilegedWin::HandleWireFormat diff --git a/ipc/attachment_broker_privileged_win.h b/ipc/attachment_broker_privileged_win.h index 66bf788..dca05f5 100644 --- a/ipc/attachment_broker_privileged_win.h +++ b/ipc/attachment_broker_privileged_win.h @@ -5,21 +5,16 @@ #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_ #define IPC_ATTACHMENT_BROKER_PRIVILEGED_WIN_H_ -#include <vector> - -#include "ipc/attachment_broker.h" +#include "ipc/attachment_broker_privileged.h" #include "ipc/handle_attachment_win.h" #include "ipc/ipc_export.h" namespace IPC { -class Channel; - -// This class is an implementation of AttachmentBroker for a privileged process -// on the Windows platform. When unprivileged processes want to send -// attachments, the attachments get routed through the privileged process, and -// more specifically, an instance of this class. -class IPC_EXPORT AttachmentBrokerPrivilegedWin : public AttachmentBroker { +// This class is a concrete subclass of AttachmentBrokerPrivileged for the +// Windows platform. +class IPC_EXPORT AttachmentBrokerPrivilegedWin + : public AttachmentBrokerPrivileged { public: AttachmentBrokerPrivilegedWin(); ~AttachmentBrokerPrivilegedWin() override; @@ -31,13 +26,6 @@ class IPC_EXPORT AttachmentBrokerPrivilegedWin : public AttachmentBroker { // IPC::Listener overrides. bool OnMessageReceived(const Message& message) override; - // Each unprivileged process should have one IPC channel on which it - // communicates attachment information with this privileged process. These - // channels must be registered and deregistered with the Attachment Broker as - // they are created and destroyed. - void RegisterCommunicationChannel(Channel* channel); - void DeregisterCommunicationChannel(Channel* channel); - private: using HandleWireFormat = internal::HandleAttachmentWin::WireFormat; // IPC message handlers. @@ -52,7 +40,6 @@ class IPC_EXPORT AttachmentBrokerPrivilegedWin : public AttachmentBroker { // observers. Otherwise, send it in an IPC to its destination. void RouteDuplicatedHandle(const HandleWireFormat& wire_format); - std::vector<Channel*> channels_; DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivilegedWin); }; diff --git a/ipc/attachment_broker_privileged_win_unittest.cc b/ipc/attachment_broker_privileged_win_unittest.cc index ea0c06d..2140fd9 100644 --- a/ipc/attachment_broker_privileged_win_unittest.cc +++ b/ipc/attachment_broker_privileged_win_unittest.cc @@ -11,7 +11,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "ipc/attachment_broker_privileged_win.h" -#include "ipc/attachment_broker_win.h" +#include "ipc/attachment_broker_unprivileged_win.h" #include "ipc/handle_attachment_win.h" #include "ipc/ipc_listener.h" #include "ipc/ipc_message.h" @@ -151,11 +151,13 @@ class IPCAttachmentBrokerPrivilegedWinTest : public IPCTestBase { void TearDown() override { IPCTestBase::TearDown(); } // Takes ownership of |broker|. Has no effect if called after CommonSetUp(). - void set_broker(IPC::AttachmentBrokerWin* broker) { broker_.reset(broker); } + void set_broker(IPC::AttachmentBrokerUnprivilegedWin* broker) { + broker_.reset(broker); + } void CommonSetUp() { if (!broker_.get()) - set_broker(new IPC::AttachmentBrokerWin); + set_broker(new IPC::AttachmentBrokerUnprivilegedWin); broker_->AddObserver(&observer_); set_attachment_broker(broker_.get()); CreateChannel(&proxy_listener_); @@ -195,7 +197,7 @@ class IPCAttachmentBrokerPrivilegedWinTest : public IPCTestBase { } ProxyListener* get_proxy_listener() { return &proxy_listener_; } - IPC::AttachmentBrokerWin* get_broker() { return broker_.get(); } + IPC::AttachmentBrokerUnprivilegedWin* get_broker() { return broker_.get(); } MockObserver* get_observer() { return &observer_; } private: @@ -203,19 +205,19 @@ class IPCAttachmentBrokerPrivilegedWinTest : public IPCTestBase { base::FilePath temp_path_; int message_index_; ProxyListener proxy_listener_; - scoped_ptr<IPC::AttachmentBrokerWin> broker_; + scoped_ptr<IPC::AttachmentBrokerUnprivilegedWin> broker_; MockObserver observer_; }; // A broker which always sets the current process as the destination process // for attachments. -class MockBroker : public IPC::AttachmentBrokerWin { +class MockBroker : public IPC::AttachmentBrokerUnprivilegedWin { public: MockBroker() {} ~MockBroker() override {} bool SendAttachmentToProcess(const IPC::BrokerableAttachment* attachment, base::ProcessId destination_process) override { - return IPC::AttachmentBrokerWin::SendAttachmentToProcess( + return IPC::AttachmentBrokerUnprivilegedWin::SendAttachmentToProcess( attachment, base::Process::Current().Pid()); } }; diff --git a/ipc/attachment_broker_unprivileged.cc b/ipc/attachment_broker_unprivileged.cc new file mode 100644 index 0000000..bc2eb5a --- /dev/null +++ b/ipc/attachment_broker_unprivileged.cc @@ -0,0 +1,13 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ipc/attachment_broker_unprivileged.h" + +namespace IPC { + +AttachmentBrokerUnprivileged::AttachmentBrokerUnprivileged() {} + +AttachmentBrokerUnprivileged::~AttachmentBrokerUnprivileged() {} + +} // namespace IPC diff --git a/ipc/attachment_broker_unprivileged.h b/ipc/attachment_broker_unprivileged.h new file mode 100644 index 0000000..3d98d49 --- /dev/null +++ b/ipc/attachment_broker_unprivileged.h @@ -0,0 +1,36 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_ +#define IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_ + +#include "ipc/attachment_broker.h" +#include "ipc/ipc_export.h" + +namespace IPC { + +class Sender; + +// This abstract subclass of AttachmentBroker is intended for use in +// non-privileged processes. +class IPC_EXPORT AttachmentBrokerUnprivileged : public IPC::AttachmentBroker { + public: + AttachmentBrokerUnprivileged(); + ~AttachmentBrokerUnprivileged() override; + + void set_sender(IPC::Sender* sender) { sender_ = sender; } + + protected: + IPC::Sender* get_sender() { return sender_; } + + private: + // |sender_| is used to send Messages to the privileged broker process. + // |sender_| must live at least as long as this instance. + IPC::Sender* sender_; + DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerUnprivileged); +}; + +} // namespace IPC + +#endif // IPC_ATTACHMENT_BROKER_UNPRIVILEGED_H_ diff --git a/ipc/attachment_broker_win.cc b/ipc/attachment_broker_unprivileged_win.cc index 1bc013d..3d3e845 100644 --- a/ipc/attachment_broker_win.cc +++ b/ipc/attachment_broker_unprivileged_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ipc/attachment_broker_win.h" +#include "ipc/attachment_broker_unprivileged_win.h" #include "base/process/process.h" #include "ipc/attachment_broker_messages.h" @@ -12,13 +12,11 @@ namespace IPC { -AttachmentBrokerWin::AttachmentBrokerWin() { -} +AttachmentBrokerUnprivilegedWin::AttachmentBrokerUnprivilegedWin() {} -AttachmentBrokerWin::~AttachmentBrokerWin() { -} +AttachmentBrokerUnprivilegedWin::~AttachmentBrokerUnprivilegedWin() {} -bool AttachmentBrokerWin::SendAttachmentToProcess( +bool AttachmentBrokerUnprivilegedWin::SendAttachmentToProcess( const BrokerableAttachment* attachment, base::ProcessId destination_process) { switch (attachment->GetBrokerableType()) { @@ -27,14 +25,15 @@ bool AttachmentBrokerWin::SendAttachmentToProcess( static_cast<const internal::HandleAttachmentWin*>(attachment); internal::HandleAttachmentWin::WireFormat format = handle_attachment->GetWireFormat(destination_process); - return sender_->Send(new AttachmentBrokerMsg_DuplicateWinHandle(format)); + return get_sender()->Send( + new AttachmentBrokerMsg_DuplicateWinHandle(format)); } return false; } -bool AttachmentBrokerWin::OnMessageReceived(const Message& msg) { +bool AttachmentBrokerUnprivilegedWin::OnMessageReceived(const Message& msg) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP(AttachmentBrokerWin, msg) + IPC_BEGIN_MESSAGE_MAP(AttachmentBrokerUnprivilegedWin, msg) IPC_MESSAGE_HANDLER(AttachmentBrokerMsg_WinHandleHasBeenDuplicated, OnWinHandleHasBeenDuplicated) IPC_MESSAGE_UNHANDLED(handled = false) @@ -42,7 +41,7 @@ bool AttachmentBrokerWin::OnMessageReceived(const Message& msg) { return handled; } -void AttachmentBrokerWin::OnWinHandleHasBeenDuplicated( +void AttachmentBrokerUnprivilegedWin::OnWinHandleHasBeenDuplicated( const IPC::internal::HandleAttachmentWin::WireFormat& wire_format) { // The IPC message was intended for a different process. Ignore it. if (wire_format.destination_process != base::Process::Current().Pid()) diff --git a/ipc/attachment_broker_win.h b/ipc/attachment_broker_unprivileged_win.h index dc6f8f7..c3d2909 100644 --- a/ipc/attachment_broker_win.h +++ b/ipc/attachment_broker_unprivileged_win.h @@ -2,27 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IPC_ATTACHMENT_BROKER_WIN_H_ -#define IPC_ATTACHMENT_BROKER_WIN_H_ +#ifndef IPC_ATTACHMENT_BROKER_UNPRIVILEGED_WIN_H_ +#define IPC_ATTACHMENT_BROKER_UNPRIVILEGED_WIN_H_ -#include <vector> - -#include "base/memory/ref_counted.h" -#include "ipc/attachment_broker.h" -#include "ipc/brokerable_attachment.h" +#include "ipc/attachment_broker_unprivileged.h" #include "ipc/handle_attachment_win.h" #include "ipc/ipc_export.h" namespace IPC { -class Sender; +class BrokerableAttachment; // This class is an implementation of AttachmentBroker for the Windows platform // for non-privileged processes. -class IPC_EXPORT AttachmentBrokerWin : public IPC::AttachmentBroker { +class IPC_EXPORT AttachmentBrokerUnprivilegedWin + : public IPC::AttachmentBrokerUnprivileged { public: - AttachmentBrokerWin(); - ~AttachmentBrokerWin() override; + AttachmentBrokerUnprivilegedWin(); + ~AttachmentBrokerUnprivilegedWin() override; // IPC::AttachmentBroker overrides. bool SendAttachmentToProcess(const BrokerableAttachment* attachment, @@ -31,21 +28,14 @@ class IPC_EXPORT AttachmentBrokerWin : public IPC::AttachmentBroker { // IPC::Listener overrides. bool OnMessageReceived(const Message& message) override; - // |sender_| is used to send Messages to the broker. |sender_| must live at - // least as long as this instance. - void set_sender(IPC::Sender* sender) { sender_ = sender; } - private: // IPC message handlers. void OnWinHandleHasBeenDuplicated( const IPC::internal::HandleAttachmentWin::WireFormat& wire_format); - // |sender_| is used to send Messages to the broker. |sender_| must live at - // least as long as this instance. - IPC::Sender* sender_; - DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerWin); + DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerUnprivilegedWin); }; } // namespace IPC -#endif // IPC_ATTACHMENT_BROKER_WIN_H_ +#endif // IPC_ATTACHMENT_BROKER_UNPRIVILEGED_WIN_H_ diff --git a/ipc/attachment_broker_win_unittest.cc b/ipc/attachment_broker_unprivileged_win_unittest.cc index 1e7db65..c260997 100644 --- a/ipc/attachment_broker_win_unittest.cc +++ b/ipc/attachment_broker_unprivileged_win_unittest.cc @@ -10,20 +10,20 @@ #include "base/memory/scoped_ptr.h" #include "base/process/process.h" #include "ipc/attachment_broker_messages.h" -#include "ipc/attachment_broker_win.h" +#include "ipc/attachment_broker_unprivileged_win.h" #include "ipc/handle_attachment_win.h" #include "testing/gtest/include/gtest/gtest.h" namespace IPC { -TEST(AttachmentBrokerWinTest, ReceiveValidMessage) { +TEST(AttachmentBrokerUnprivilegedWinTest, ReceiveValidMessage) { HANDLE handle = LongToHandle(8); base::ProcessId destination = base::Process::Current().Pid(); scoped_refptr<internal::HandleAttachmentWin> attachment( new internal::HandleAttachmentWin(handle)); AttachmentBrokerMsg_WinHandleHasBeenDuplicated msg( attachment->GetWireFormat(destination)); - AttachmentBrokerWin attachment_broker; + AttachmentBrokerUnprivilegedWin attachment_broker; EXPECT_TRUE(attachment_broker.OnMessageReceived(msg)); EXPECT_EQ(1u, attachment_broker.attachments_.size()); @@ -36,14 +36,14 @@ TEST(AttachmentBrokerWinTest, ReceiveValidMessage) { EXPECT_EQ(handle, received_handle_attachment->get_handle()); } -TEST(AttachmentBrokerWinTest, ReceiveInvalidMessage) { +TEST(AttachmentBrokerUnprivilegedWinTest, ReceiveInvalidMessage) { HANDLE handle = LongToHandle(8); base::ProcessId destination = base::Process::Current().Pid() + 1; scoped_refptr<internal::HandleAttachmentWin> attachment( new internal::HandleAttachmentWin(handle)); AttachmentBrokerMsg_WinHandleHasBeenDuplicated msg( attachment->GetWireFormat(destination)); - AttachmentBrokerWin attachment_broker; + AttachmentBrokerUnprivilegedWin attachment_broker; EXPECT_TRUE(attachment_broker.OnMessageReceived(msg)); EXPECT_EQ(0u, attachment_broker.attachments_.size()); } diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp index c2f8745..fb64c32 100644 --- a/ipc/ipc.gyp +++ b/ipc/ipc.gyp @@ -46,7 +46,7 @@ ], 'sources': [ 'attachment_broker_privileged_win_unittest.cc', - 'attachment_broker_win_unittest.cc', + 'attachment_broker_unprivileged_win_unittest.cc', 'ipc_channel_posix_unittest.cc', 'ipc_channel_proxy_unittest.cc', 'ipc_channel_reader_unittest.cc', diff --git a/ipc/ipc.gypi b/ipc/ipc.gypi index 2cda257..0ded800 100644 --- a/ipc/ipc.gypi +++ b/ipc/ipc.gypi @@ -14,10 +14,14 @@ 'attachment_broker.cc', 'attachment_broker.h', 'attachment_broker_messages.h', + 'attachment_broker_privileged.cc', + 'attachment_broker_privileged.h', 'attachment_broker_privileged_win.cc', 'attachment_broker_privileged_win.h', - 'attachment_broker_win.cc', - 'attachment_broker_win.h', + 'attachment_broker_unprivileged.cc', + 'attachment_broker_unprivileged.h', + 'attachment_broker_unprivileged_win.cc', + 'attachment_broker_unprivileged_win.h', 'brokerable_attachment.cc', 'brokerable_attachment.h', 'handle_attachment_win.cc', |