OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 5 #ifndef CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
6 #define CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 6 #define CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "content/public/common/child_process_host_delegate.h" | 13 #include "content/public/common/child_process_host_delegate.h" |
14 #include "ipc/ipc_platform_file.h" | 14 #include "ipc/ipc_platform_file.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class CommandLine; | 17 class CommandLine; |
18 class File; | 18 class File; |
19 class FilePath; | 19 class FilePath; |
20 class MessageLoopProxy; | |
21 class ScopedTempDir; | 20 class ScopedTempDir; |
22 } // namespace base | 21 } // namespace base |
23 | 22 |
24 namespace content { | 23 namespace content { |
25 class ChildProcessHost; | 24 class ChildProcessHost; |
26 } | 25 } |
27 | 26 |
28 namespace printing { | 27 namespace printing { |
29 class MetafilePlayer; | 28 class MetafilePlayer; |
30 class PdfRenderSettings; | 29 class PdfRenderSettings; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 friend class ServiceUtilityProcessHost; | 76 friend class ServiceUtilityProcessHost; |
78 | 77 |
79 // Invoked when a metafile file is ready. | 78 // Invoked when a metafile file is ready. |
80 // Returns true if metafile successfully loaded from |file|. | 79 // Returns true if metafile successfully loaded from |file|. |
81 bool MetafileAvailable(float scale_factor, base::File file); | 80 bool MetafileAvailable(float scale_factor, base::File file); |
82 | 81 |
83 DISALLOW_COPY_AND_ASSIGN(Client); | 82 DISALLOW_COPY_AND_ASSIGN(Client); |
84 }; | 83 }; |
85 | 84 |
86 ServiceUtilityProcessHost(Client* client, | 85 ServiceUtilityProcessHost(Client* client, |
87 base::MessageLoopProxy* client_message_loop_proxy); | 86 base::SingleThreadTaskRunner* client_task_runner); |
88 ~ServiceUtilityProcessHost() override; | 87 ~ServiceUtilityProcessHost() override; |
89 | 88 |
90 // Starts a process to render the specified pages in the given PDF file into | 89 // Starts a process to render the specified pages in the given PDF file into |
91 // a metafile. Currently only implemented for Windows. If the PDF has fewer | 90 // a metafile. Currently only implemented for Windows. If the PDF has fewer |
92 // pages than the specified page ranges, it will render as many as available. | 91 // pages than the specified page ranges, it will render as many as available. |
93 bool StartRenderPDFPagesToMetafile( | 92 bool StartRenderPDFPagesToMetafile( |
94 const base::FilePath& pdf_path, | 93 const base::FilePath& pdf_path, |
95 const printing::PdfRenderSettings& render_settings); | 94 const printing::PdfRenderSettings& render_settings); |
96 | 95 |
97 // Starts a process to get capabilities and defaults for the specified | 96 // Starts a process to get capabilities and defaults for the specified |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void OnGetPrinterSemanticCapsAndDefaultsSucceeded( | 138 void OnGetPrinterSemanticCapsAndDefaultsSucceeded( |
140 const std::string& printer_name, | 139 const std::string& printer_name, |
141 const printing::PrinterSemanticCapsAndDefaults& caps_and_defaults); | 140 const printing::PrinterSemanticCapsAndDefaults& caps_and_defaults); |
142 void OnGetPrinterSemanticCapsAndDefaultsFailed( | 141 void OnGetPrinterSemanticCapsAndDefaultsFailed( |
143 const std::string& printer_name); | 142 const std::string& printer_name); |
144 | 143 |
145 scoped_ptr<content::ChildProcessHost> child_process_host_; | 144 scoped_ptr<content::ChildProcessHost> child_process_host_; |
146 base::Process process_; | 145 base::Process process_; |
147 // A pointer to our client interface, who will be informed of progress. | 146 // A pointer to our client interface, who will be informed of progress. |
148 scoped_refptr<Client> client_; | 147 scoped_refptr<Client> client_; |
149 scoped_refptr<base::MessageLoopProxy> client_message_loop_proxy_; | 148 scoped_refptr<base::SingleThreadTaskRunner> client_task_runner_; |
150 bool waiting_for_reply_; | 149 bool waiting_for_reply_; |
151 | 150 |
152 // Start time of operation. | 151 // Start time of operation. |
153 base::Time start_time_; | 152 base::Time start_time_; |
154 | 153 |
155 class PdfToEmfState; | 154 class PdfToEmfState; |
156 scoped_ptr<PdfToEmfState> pdf_to_emf_state_; | 155 scoped_ptr<PdfToEmfState> pdf_to_emf_state_; |
157 | 156 |
158 base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_; | 157 base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_; |
159 | 158 |
160 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); | 159 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); |
161 }; | 160 }; |
162 | 161 |
163 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 162 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
OLD | NEW |