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

Side by Side Diff: chrome/browser/nacl_host/nacl_broker_host_win.cc

Issue 7863024: Make the NaCl windows 64 bit binaries not depend on chrome targets. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: simplify chrome_exe.gypi Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/app/nacl64_dll.ver ('k') | chrome/browser/nacl_host/nacl_process_host.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/nacl_host/nacl_broker_service_win.h" 10 #include "chrome/browser/nacl_host/nacl_broker_service_win.h"
11 #include "chrome/browser/nacl_host/nacl_process_host.h" 11 #include "chrome/browser/nacl_host/nacl_process_host.h"
12 #include "chrome/common/chrome_constants.h" 12 #include "chrome/common/chrome_constants.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/logging_chrome.h"
14 #include "chrome/common/nacl_cmd_line.h" 15 #include "chrome/common/nacl_cmd_line.h"
15 #include "chrome/common/nacl_messages.h" 16 #include "chrome/common/nacl_messages.h"
16 17
17 NaClBrokerHost::NaClBrokerHost() 18 NaClBrokerHost::NaClBrokerHost()
18 : BrowserChildProcessHost(NACL_BROKER_PROCESS), 19 : BrowserChildProcessHost(NACL_BROKER_PROCESS),
19 stopping_(false) { 20 stopping_(false) {
20 } 21 }
21 22
22 NaClBrokerHost::~NaClBrokerHost() { 23 NaClBrokerHost::~NaClBrokerHost() {
23 } 24 }
24 25
25 bool NaClBrokerHost::Init() { 26 bool NaClBrokerHost::Init() {
26 // Create the channel that will be used for communicating with the broker. 27 // Create the channel that will be used for communicating with the broker.
27 if (!CreateChannel()) 28 if (!CreateChannel())
28 return false; 29 return false;
29 30
30 // Create the path to the nacl broker/loader executable. 31 // Create the path to the nacl broker/loader executable.
31 FilePath module_path; 32 FilePath module_path;
32 if (!PathService::Get(base::FILE_MODULE, &module_path)) 33 if (!PathService::Get(base::FILE_MODULE, &module_path))
33 return false; 34 return false;
34 35
35 FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName); 36 FilePath nacl_path = module_path.DirName().Append(chrome::kNaClAppName);
36 CommandLine* cmd_line = new CommandLine(nacl_path); 37 CommandLine* cmd_line = new CommandLine(nacl_path);
37 nacl::CopyNaClCommandLineArguments(cmd_line); 38 nacl::CopyNaClCommandLineArguments(cmd_line);
38 39
39 cmd_line->AppendSwitchASCII(switches::kProcessType, 40 cmd_line->AppendSwitchASCII(switches::kProcessType,
40 switches::kNaClBrokerProcess); 41 switches::kNaClBrokerProcess);
41
42 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id()); 42 cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
43 if (logging::DialogsAreSuppressed())
44 cmd_line->AppendSwitch(switches::kNoErrorDialogs);
43 45
44 BrowserChildProcessHost::Launch(FilePath(), cmd_line); 46 BrowserChildProcessHost::Launch(FilePath(), cmd_line);
45 return true; 47 return true;
46 } 48 }
47 49
48 bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { 50 bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) {
49 bool handled = true; 51 bool handled = true;
50 IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg) 52 IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg)
51 IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched) 53 IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched)
52 IPC_MESSAGE_UNHANDLED(handled = false) 54 IPC_MESSAGE_UNHANDLED(handled = false)
53 IPC_END_MESSAGE_MAP() 55 IPC_END_MESSAGE_MAP()
54 return handled; 56 return handled;
55 } 57 }
56 58
57 bool NaClBrokerHost::LaunchLoader( 59 bool NaClBrokerHost::LaunchLoader(
58 const std::wstring& loader_channel_id) { 60 const std::wstring& loader_channel_id) {
59 return Send(new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id)); 61 return Send(new NaClProcessMsg_LaunchLoaderThroughBroker(loader_channel_id));
60 } 62 }
61 63
62 void NaClBrokerHost::OnLoaderLaunched(const std::wstring& loader_channel_id, 64 void NaClBrokerHost::OnLoaderLaunched(const std::wstring& loader_channel_id,
63 base::ProcessHandle handle) { 65 base::ProcessHandle handle) {
64 NaClBrokerService::GetInstance()->OnLoaderLaunched(loader_channel_id, handle); 66 NaClBrokerService::GetInstance()->OnLoaderLaunched(loader_channel_id, handle);
65 } 67 }
66 68
67 void NaClBrokerHost::StopBroker() { 69 void NaClBrokerHost::StopBroker() {
68 stopping_ = true; 70 stopping_ = true;
69 Send(new NaClProcessMsg_StopBroker()); 71 Send(new NaClProcessMsg_StopBroker());
70 } 72 }
OLDNEW
« no previous file with comments | « chrome/app/nacl64_dll.ver ('k') | chrome/browser/nacl_host/nacl_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698