OLD | NEW |
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/service/service_utility_process_host.h" | 5 #include "chrome/service/service_utility_process_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() { | 146 FilePath ServiceUtilityProcessHost::GetUtilityProcessCmd() { |
147 #if defined(OS_LINUX) | 147 #if defined(OS_LINUX) |
148 int flags = ChildProcessHost::CHILD_ALLOW_SELF; | 148 int flags = ChildProcessHost::CHILD_ALLOW_SELF; |
149 #else | 149 #else |
150 int flags = ChildProcessHost::CHILD_NORMAL; | 150 int flags = ChildProcessHost::CHILD_NORMAL; |
151 #endif | 151 #endif |
152 return ChildProcessHost::GetChildPath(flags); | 152 return ChildProcessHost::GetChildPath(flags); |
153 } | 153 } |
154 | 154 |
155 bool ServiceUtilityProcessHost::CanShutdown() { | |
156 return true; | |
157 } | |
158 | |
159 void ServiceUtilityProcessHost::OnChildDisconnected() { | 155 void ServiceUtilityProcessHost::OnChildDisconnected() { |
160 if (waiting_for_reply_) { | 156 if (waiting_for_reply_) { |
161 // If we are yet to receive a reply then notify the client that the | 157 // If we are yet to receive a reply then notify the client that the |
162 // child died. | 158 // child died. |
163 client_message_loop_proxy_->PostTask( | 159 client_message_loop_proxy_->PostTask( |
164 FROM_HERE, base::Bind(&Client::OnChildDied, client_.get())); | 160 FROM_HERE, base::Bind(&Client::OnChildDied, client_.get())); |
165 } | 161 } |
166 delete this; | 162 delete this; |
167 } | 163 } |
168 | 164 |
169 void ServiceUtilityProcessHost::ShutdownStarted() { | |
170 } | |
171 | |
172 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { | 165 bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { |
173 bool handled = true; | 166 bool handled = true; |
174 IPC_BEGIN_MESSAGE_MAP(ServiceUtilityProcessHost, message) | 167 IPC_BEGIN_MESSAGE_MAP(ServiceUtilityProcessHost, message) |
175 IPC_MESSAGE_HANDLER( | 168 IPC_MESSAGE_HANDLER( |
176 ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded, | 169 ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded, |
177 OnRenderPDFPagesToMetafileSucceeded) | 170 OnRenderPDFPagesToMetafileSucceeded) |
178 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed, | 171 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed, |
179 OnRenderPDFPagesToMetafileFailed) | 172 OnRenderPDFPagesToMetafileFailed) |
180 IPC_MESSAGE_HANDLER( | 173 IPC_MESSAGE_HANDLER( |
181 ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, | 174 ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 printing::Emf metafile; | 238 printing::Emf metafile; |
246 if (!metafile.InitFromFile(metafile_path)) { | 239 if (!metafile.InitFromFile(metafile_path)) { |
247 OnRenderPDFPagesToMetafileFailed(); | 240 OnRenderPDFPagesToMetafileFailed(); |
248 } else { | 241 } else { |
249 OnRenderPDFPagesToMetafileSucceeded(metafile, | 242 OnRenderPDFPagesToMetafileSucceeded(metafile, |
250 highest_rendered_page_number); | 243 highest_rendered_page_number); |
251 } | 244 } |
252 #endif // defined(OS_WIN) | 245 #endif // defined(OS_WIN) |
253 } | 246 } |
254 | 247 |
OLD | NEW |