| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "content/public/common/child_process_host_delegate.h" | 14 #include "content/public/common/child_process_host_delegate.h" |
| 15 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 16 #include "mojo/edk/embedder/pending_process_connection.h" | 16 #include "mojo/edk/embedder/pending_process_connection.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class CommandLine; | 19 class CommandLine; |
| 20 class File; | 20 class File; |
| 21 class FilePath; | 21 class FilePath; |
| 22 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 23 } // namespace base | 23 } // namespace base |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class ChildProcessHost; | 26 class ChildProcessHost; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace printing { | 29 namespace printing { |
| 30 class MetafilePlayer; |
| 30 struct PdfRenderSettings; | 31 struct PdfRenderSettings; |
| 31 struct PrinterCapsAndDefaults; | 32 struct PrinterCapsAndDefaults; |
| 32 struct PrinterSemanticCapsAndDefaults; | 33 struct PrinterSemanticCapsAndDefaults; |
| 33 } // namespace printing | 34 } // namespace printing |
| 34 | 35 |
| 35 // Acts as the service-side host to a utility child process. A | 36 // Acts as the service-side host to a utility child process. A |
| 36 // utility process is a short-lived sandboxed process that is created to run | 37 // utility process is a short-lived sandboxed process that is created to run |
| 37 // a specific task. | 38 // a specific task. |
| 38 class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { | 39 class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { |
| 39 public: | 40 public: |
| 40 // Consumers of ServiceUtilityProcessHost must implement this interface to | 41 // Consumers of ServiceUtilityProcessHost must implement this interface to |
| 41 // get results back. All functions are called on the thread passed along | 42 // get results back. All functions are called on the thread passed along |
| 42 // to ServiceUtilityProcessHost. | 43 // to ServiceUtilityProcessHost. |
| 43 class Client : public base::RefCountedThreadSafe<Client> { | 44 class Client : public base::RefCountedThreadSafe<Client> { |
| 44 public: | 45 public: |
| 45 Client() {} | 46 Client() {} |
| 46 | 47 |
| 47 // Called when the child process died before a reply was receieved. | 48 // Called when the child process died before a reply was receieved. |
| 48 virtual void OnChildDied() {} | 49 virtual void OnChildDied() {} |
| 49 | 50 |
| 50 virtual bool OnRenderPDFPagesToMetafilePageDone( | 51 virtual void OnRenderPDFPagesToMetafilePageDone( |
| 51 const std::vector<char>& emf_data, | 52 float scale_factor, |
| 52 float scale_factor); | 53 const printing::MetafilePlayer& emf) {} |
| 53 | 54 |
| 54 // Called when at all pages in the PDF has been rendered. | 55 // Called when at all pages in the PDF has been rendered. |
| 55 virtual void OnRenderPDFPagesToMetafileDone(bool success) {} | 56 virtual void OnRenderPDFPagesToMetafileDone(bool success) {} |
| 56 | 57 |
| 57 // Called when the printer capabilities and defaults have been | 58 // Called when the printer capabilities and defaults have been |
| 58 // retrieved successfully or if retrieval failed. | 59 // retrieved successfully or if retrieval failed. |
| 59 virtual void OnGetPrinterCapsAndDefaults( | 60 virtual void OnGetPrinterCapsAndDefaults( |
| 60 bool succedded, | 61 bool succedded, |
| 61 const std::string& printer_name, | 62 const std::string& printer_name, |
| 62 const printing::PrinterCapsAndDefaults& caps_and_defaults) {} | 63 const printing::PrinterCapsAndDefaults& caps_and_defaults) {} |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 154 |
| 154 class PdfToEmfState; | 155 class PdfToEmfState; |
| 155 std::unique_ptr<PdfToEmfState> pdf_to_emf_state_; | 156 std::unique_ptr<PdfToEmfState> pdf_to_emf_state_; |
| 156 | 157 |
| 157 base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_; | 158 base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_; |
| 158 | 159 |
| 159 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); | 160 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 163 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
| OLD | NEW |