Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: ipc/attachment_broker_win.cc

Issue 1188923003: Stub in more IPC attachment brokering functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing files. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ipc/attachment_broker_win.cc
diff --git a/ipc/attachment_broker_win.cc b/ipc/attachment_broker_win.cc
index caf80b8f488d03981bc86593542c3d74d6159fca..489fcdd4c52776abce96ecba32ac2471675cdb6f 100644
--- a/ipc/attachment_broker_win.cc
+++ b/ipc/attachment_broker_win.cc
@@ -4,6 +4,11 @@
#include "ipc/attachment_broker_win.h"
+#include "ipc/attachment_broker_messages.h"
+#include "ipc/brokerable_attachment.h"
+#include "ipc/handle_attachment_win.h"
+#include "ipc/ipc_sender.h"
+
namespace IPC {
AttachmentBrokerWin::AttachmentBrokerWin() {
@@ -18,10 +23,19 @@ void AttachmentBrokerWin::OnReceiveDuplicatedHandle(
// TODO(erikchen): Implement me. http://crbug.com/493414
}
-void AttachmentBrokerWin::SendAttachmentToProcess(
+bool AttachmentBrokerWin::SendAttachmentToProcess(
BrokerableAttachment* attachment,
base::ProcessId destination_process) {
- // TODO(erikchen): Implement me. http://crbug.com/493414
+ switch (attachment->GetBrokerableType()) {
+ case BrokerableAttachment::WIN_HANDLE:
+ internal::HandleAttachmentWin* handle_attachment =
+ static_cast<internal::HandleAttachmentWin*>(attachment);
+ internal::HandleAttachmentWin::WireFormat format =
+ handle_attachment->GetWireFormat(destination_process);
+ Message* m = new AttachmentBrokerMsg_RequestBrokerageOfWinHandle(format);
Tom Sepez 2015/06/19 18:04:10 nit: no need for |m|, the pattern is usually just
erikchen 2015/06/23 22:36:59 Done.
+ return sender_->Send(m);
+ }
+ return false;
}
bool AttachmentBrokerWin::GetAttachmentWithId(
@@ -31,4 +45,8 @@ bool AttachmentBrokerWin::GetAttachmentWithId(
return false;
}
+void AttachmentBrokerWin::SetSender(IPC::Sender* sender) {
Tom Sepez 2015/06/19 18:04:10 nit: move trivial setter to header.
erikchen 2015/06/23 22:36:59 Done.
+ sender_ = sender;
+}
+
} // namespace IPC

Powered by Google App Engine
This is Rietveld 408576698