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

Side by Side Diff: components/nacl/broker/nacl_broker_listener.cc

Issue 1688433005: Revert of Clean up public interface of AttachmentBrokerUnprivileged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « components/nacl/broker/nacl_broker_listener.h ('k') | components/nacl/loader/nacl_listener.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/nacl/broker/nacl_broker_listener.h" 5 #include "components/nacl/broker/nacl_broker_listener.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 14 matching lines...) Expand all
25 25
26 namespace { 26 namespace {
27 27
28 void SendReply(IPC::Channel* channel, int32_t pid, bool result) { 28 void SendReply(IPC::Channel* channel, int32_t pid, bool result) {
29 channel->Send(new NaClProcessMsg_DebugExceptionHandlerLaunched(pid, result)); 29 channel->Send(new NaClProcessMsg_DebugExceptionHandlerLaunched(pid, result));
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 NaClBrokerListener::NaClBrokerListener() { 34 NaClBrokerListener::NaClBrokerListener() {
35 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded(); 35 attachment_broker_.reset(
36 IPC::AttachmentBrokerUnprivileged::CreateBroker().release());
36 } 37 }
37 38
38 NaClBrokerListener::~NaClBrokerListener() { 39 NaClBrokerListener::~NaClBrokerListener() {
39 } 40 }
40 41
41 void NaClBrokerListener::Listen() { 42 void NaClBrokerListener::Listen() {
42 std::string channel_name = 43 std::string channel_name =
43 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 44 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
44 switches::kProcessChannelID); 45 switches::kProcessChannelID);
45 channel_ = IPC::Channel::CreateClient(channel_name, this); 46 channel_ = IPC::Channel::CreateClient(channel_name, this);
46 IPC::AttachmentBroker* global = IPC::AttachmentBroker::GetGlobal(); 47 if (attachment_broker_.get())
47 if (global && !global->IsPrivilegedBroker()) 48 attachment_broker_->DesignateBrokerCommunicationChannel(channel_.get());
48 global->DesignateBrokerCommunicationChannel(channel_.get());
49 CHECK(channel_->Connect()); 49 CHECK(channel_->Connect());
50 base::MessageLoop::current()->Run(); 50 base::MessageLoop::current()->Run();
51 } 51 }
52 52
53 // NOTE: changes to this method need to be reviewed by the security team. 53 // NOTE: changes to this method need to be reviewed by the security team.
54 bool NaClBrokerListener::PreSpawnTarget(sandbox::TargetPolicy* policy) { 54 bool NaClBrokerListener::PreSpawnTarget(sandbox::TargetPolicy* policy) {
55 // This code is duplicated in chrome_content_browser_client.cc. 55 // This code is duplicated in chrome_content_browser_client.cc.
56 56
57 // Allow the server side of a pipe restricted to the "chrome.nacl." 57 // Allow the server side of a pipe restricted to the "chrome.nacl."
58 // namespace so that it cannot impersonate other system or other chrome 58 // namespace so that it cannot impersonate other system or other chrome
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 const std::string& startup_info) { 133 const std::string& startup_info) {
134 NaClStartDebugExceptionHandlerThread( 134 NaClStartDebugExceptionHandlerThread(
135 base::Process(process_handle), startup_info, 135 base::Process(process_handle), startup_info,
136 base::ThreadTaskRunnerHandle::Get(), 136 base::ThreadTaskRunnerHandle::Get(),
137 base::Bind(SendReply, channel_.get(), pid)); 137 base::Bind(SendReply, channel_.get(), pid));
138 } 138 }
139 139
140 void NaClBrokerListener::OnStopBroker() { 140 void NaClBrokerListener::OnStopBroker() {
141 base::MessageLoop::current()->QuitWhenIdle(); 141 base::MessageLoop::current()->QuitWhenIdle();
142 } 142 }
OLDNEW
« no previous file with comments | « components/nacl/broker/nacl_broker_listener.h ('k') | components/nacl/loader/nacl_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698