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

Side by Side Diff: ipc/attachment_broker_privileged_win.cc

Issue 1317093007: ipc: Make a new class PlaceholderBrokerableAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase errors. Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « ipc/BUILD.gn ('k') | ipc/attachment_broker_unprivileged_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/attachment_broker_privileged_win.h" 5 #include "ipc/attachment_broker_privileged_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "ipc/attachment_broker_messages.h" 10 #include "ipc/attachment_broker_messages.h"
11 #include "ipc/brokerable_attachment.h" 11 #include "ipc/brokerable_attachment.h"
12 #include "ipc/handle_attachment_win.h" 12 #include "ipc/handle_attachment_win.h"
13 #include "ipc/ipc_channel.h" 13 #include "ipc/ipc_channel.h"
14 14
15 namespace IPC { 15 namespace IPC {
16 16
17 AttachmentBrokerPrivilegedWin::AttachmentBrokerPrivilegedWin() {} 17 AttachmentBrokerPrivilegedWin::AttachmentBrokerPrivilegedWin() {}
18 18
19 AttachmentBrokerPrivilegedWin::~AttachmentBrokerPrivilegedWin() {} 19 AttachmentBrokerPrivilegedWin::~AttachmentBrokerPrivilegedWin() {}
20 20
21 bool AttachmentBrokerPrivilegedWin::SendAttachmentToProcess( 21 bool AttachmentBrokerPrivilegedWin::SendAttachmentToProcess(
22 const BrokerableAttachment* attachment, 22 const BrokerableAttachment* attachment,
23 base::ProcessId destination_process) { 23 base::ProcessId destination_process) {
24 switch (attachment->GetBrokerableType()) { 24 switch (attachment->GetBrokerableType()) {
25 case BrokerableAttachment::WIN_HANDLE: 25 case BrokerableAttachment::WIN_HANDLE: {
26 const internal::HandleAttachmentWin* handle_attachment = 26 const internal::HandleAttachmentWin* handle_attachment =
27 static_cast<const internal::HandleAttachmentWin*>(attachment); 27 static_cast<const internal::HandleAttachmentWin*>(attachment);
28 HandleWireFormat wire_format = 28 HandleWireFormat wire_format =
29 handle_attachment->GetWireFormat(destination_process); 29 handle_attachment->GetWireFormat(destination_process);
30 HandleWireFormat new_wire_format = 30 HandleWireFormat new_wire_format =
31 DuplicateWinHandle(wire_format, base::Process::Current().Pid()); 31 DuplicateWinHandle(wire_format, base::Process::Current().Pid());
32 if (new_wire_format.handle == 0) 32 if (new_wire_format.handle == 0)
33 return false; 33 return false;
34 RouteDuplicatedHandle(new_wire_format); 34 RouteDuplicatedHandle(new_wire_format);
35 return true; 35 return true;
36 }
37 case BrokerableAttachment::PLACEHOLDER:
38 NOTREACHED();
39 return false;
36 } 40 }
37 return false; 41 return false;
38 } 42 }
39 43
40 bool AttachmentBrokerPrivilegedWin::OnMessageReceived(const Message& msg) { 44 bool AttachmentBrokerPrivilegedWin::OnMessageReceived(const Message& msg) {
41 bool handled = true; 45 bool handled = true;
42 switch (msg.type()) { 46 switch (msg.type()) {
43 IPC_MESSAGE_HANDLER_GENERIC(AttachmentBrokerMsg_DuplicateWinHandle, 47 IPC_MESSAGE_HANDLER_GENERIC(AttachmentBrokerMsg_DuplicateWinHandle,
44 OnDuplicateWinHandle(msg)) 48 OnDuplicateWinHandle(msg))
45 IPC_MESSAGE_UNHANDLED(handled = false) 49 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 dest_process.Handle(), &new_handle, 128 dest_process.Handle(), &new_handle,
125 desired_access, FALSE, options); 129 desired_access, FALSE, options);
126 130
127 new_wire_format.handle = (result != 0) ? HandleToLong(new_handle) : 0; 131 new_wire_format.handle = (result != 0) ? HandleToLong(new_handle) : 0;
128 } 132 }
129 133
130 return new_wire_format; 134 return new_wire_format;
131 } 135 }
132 136
133 } // namespace IPC 137 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/BUILD.gn ('k') | ipc/attachment_broker_unprivileged_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698