OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 NaClBrokerListener::~NaClBrokerListener() { | 35 NaClBrokerListener::~NaClBrokerListener() { |
36 base::CloseProcessHandle(browser_handle_); | 36 base::CloseProcessHandle(browser_handle_); |
37 } | 37 } |
38 | 38 |
39 void NaClBrokerListener::Listen() { | 39 void NaClBrokerListener::Listen() { |
40 std::string channel_name = | 40 std::string channel_name = |
41 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 41 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
42 switches::kProcessChannelID); | 42 switches::kProcessChannelID); |
43 channel_.reset(new IPC::Channel( | 43 channel_ = IPC::Channel::CreateClient(channel_name, this); |
44 channel_name, IPC::Channel::MODE_CLIENT, this)); | |
45 CHECK(channel_->Connect()); | 44 CHECK(channel_->Connect()); |
46 base::MessageLoop::current()->Run(); | 45 base::MessageLoop::current()->Run(); |
47 } | 46 } |
48 | 47 |
49 // NOTE: changes to this method need to be reviewed by the security team. | 48 // NOTE: changes to this method need to be reviewed by the security team. |
50 void NaClBrokerListener::PreSpawnTarget(sandbox::TargetPolicy* policy, | 49 void NaClBrokerListener::PreSpawnTarget(sandbox::TargetPolicy* policy, |
51 bool* success) { | 50 bool* success) { |
52 // This code is duplicated in chrome_content_browser_client.cc. | 51 // This code is duplicated in chrome_content_browser_client.cc. |
53 | 52 |
54 // Allow the server side of a pipe restricted to the "chrome.nacl." | 53 // Allow the server side of a pipe restricted to the "chrome.nacl." |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const std::string& startup_info) { | 128 const std::string& startup_info) { |
130 NaClStartDebugExceptionHandlerThread( | 129 NaClStartDebugExceptionHandlerThread( |
131 process_handle, startup_info, | 130 process_handle, startup_info, |
132 base::MessageLoopProxy::current(), | 131 base::MessageLoopProxy::current(), |
133 base::Bind(SendReply, channel_.get(), pid)); | 132 base::Bind(SendReply, channel_.get(), pid)); |
134 } | 133 } |
135 | 134 |
136 void NaClBrokerListener::OnStopBroker() { | 135 void NaClBrokerListener::OnStopBroker() { |
137 base::MessageLoop::current()->Quit(); | 136 base::MessageLoop::current()->Quit(); |
138 } | 137 } |
OLD | NEW |