OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/nacl_host/nacl_broker_host_win.h" | 5 #include "chrome/browser/nacl_host/nacl_broker_host_win.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "ipc/ipc_switches.h" | 9 #include "ipc/ipc_switches.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (!PathService::Get(base::FILE_MODULE, &module_path)) | 40 if (!PathService::Get(base::FILE_MODULE, &module_path)) |
41 return false; | 41 return false; |
42 | 42 |
43 FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); | 43 FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); |
44 CommandLine* cmd_line = new CommandLine(nacl_path); | 44 CommandLine* cmd_line = new CommandLine(nacl_path); |
45 nacl::CopyNaClCommandLineArguments(cmd_line); | 45 nacl::CopyNaClCommandLineArguments(cmd_line); |
46 | 46 |
47 cmd_line->AppendSwitchWithValue(switches::kProcessType, | 47 cmd_line->AppendSwitchWithValue(switches::kProcessType, |
48 switches::kNaClBrokerProcess); | 48 switches::kNaClBrokerProcess); |
49 | 49 |
50 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, | 50 cmd_line->AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); |
51 ASCIIToWide(channel_id())); | |
52 | 51 |
53 BrowserChildProcessHost::Launch(FilePath(), cmd_line); | 52 BrowserChildProcessHost::Launch(FilePath(), cmd_line); |
54 return true; | 53 return true; |
55 } | 54 } |
56 | 55 |
57 void NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { | 56 void NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { |
58 IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg) | 57 IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg) |
59 IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched) | 58 IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched) |
60 IPC_END_MESSAGE_MAP() | 59 IPC_END_MESSAGE_MAP() |
61 } | 60 } |
62 | 61 |
63 bool NaClBrokerHost::LaunchLoader( | 62 bool NaClBrokerHost::LaunchLoader( |
64 const std::wstring& loader_channel_id) { | 63 const std::wstring& loader_channel_id) { |
65 return Send(new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id)); | 64 return Send(new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id)); |
66 } | 65 } |
67 | 66 |
68 void NaClBrokerHost::OnLoaderLaunched(const std::wstring& loader_channel_id, | 67 void NaClBrokerHost::OnLoaderLaunched(const std::wstring& loader_channel_id, |
69 base::ProcessHandle handle) { | 68 base::ProcessHandle handle) { |
70 NaClBrokerService::GetInstance()->OnLoaderLaunched(loader_channel_id, handle); | 69 NaClBrokerService::GetInstance()->OnLoaderLaunched(loader_channel_id, handle); |
71 } | 70 } |
72 | 71 |
73 void NaClBrokerHost::StopBroker() { | 72 void NaClBrokerHost::StopBroker() { |
74 stopping_ = true; | 73 stopping_ = true; |
75 Send(new NaClProcessMsg_StopBroker()); | 74 Send(new NaClProcessMsg_StopBroker()); |
76 } | 75 } |
OLD | NEW |