| 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; | |
| 31 struct PdfRenderSettings; | 30 struct PdfRenderSettings; |
| 32 struct PrinterCapsAndDefaults; | 31 struct PrinterCapsAndDefaults; |
| 33 struct PrinterSemanticCapsAndDefaults; | 32 struct PrinterSemanticCapsAndDefaults; |
| 34 } // namespace printing | 33 } // namespace printing |
| 35 | 34 |
| 36 // Acts as the service-side host to a utility child process. A | 35 // Acts as the service-side host to a utility child process. A |
| 37 // utility process is a short-lived sandboxed process that is created to run | 36 // utility process is a short-lived sandboxed process that is created to run |
| 38 // a specific task. | 37 // a specific task. |
| 39 class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { | 38 class ServiceUtilityProcessHost : public content::ChildProcessHostDelegate { |
| 40 public: | 39 public: |
| 41 // Consumers of ServiceUtilityProcessHost must implement this interface to | 40 // Consumers of ServiceUtilityProcessHost must implement this interface to |
| 42 // get results back. All functions are called on the thread passed along | 41 // get results back. All functions are called on the thread passed along |
| 43 // to ServiceUtilityProcessHost. | 42 // to ServiceUtilityProcessHost. |
| 44 class Client : public base::RefCountedThreadSafe<Client> { | 43 class Client : public base::RefCountedThreadSafe<Client> { |
| 45 public: | 44 public: |
| 46 Client() {} | 45 Client() {} |
| 47 | 46 |
| 48 // Called when the child process died before a reply was receieved. | 47 // Called when the child process died before a reply was receieved. |
| 49 virtual void OnChildDied() {} | 48 virtual void OnChildDied() {} |
| 50 | 49 |
| 51 virtual void OnRenderPDFPagesToMetafilePageDone( | 50 virtual bool OnRenderPDFPagesToMetafilePageDone( |
| 52 float scale_factor, | 51 const std::vector<char>& emf_data, |
| 53 const printing::MetafilePlayer& emf) {} | 52 float scale_factor); |
| 54 | 53 |
| 55 // Called when at all pages in the PDF has been rendered. | 54 // Called when at all pages in the PDF has been rendered. |
| 56 virtual void OnRenderPDFPagesToMetafileDone(bool success) {} | 55 virtual void OnRenderPDFPagesToMetafileDone(bool success) {} |
| 57 | 56 |
| 58 // Called when the printer capabilities and defaults have been | 57 // Called when the printer capabilities and defaults have been |
| 59 // retrieved successfully or if retrieval failed. | 58 // retrieved successfully or if retrieval failed. |
| 60 virtual void OnGetPrinterCapsAndDefaults( | 59 virtual void OnGetPrinterCapsAndDefaults( |
| 61 bool succedded, | 60 bool succedded, |
| 62 const std::string& printer_name, | 61 const std::string& printer_name, |
| 63 const printing::PrinterCapsAndDefaults& caps_and_defaults) {} | 62 const printing::PrinterCapsAndDefaults& caps_and_defaults) {} |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 153 |
| 155 class PdfToEmfState; | 154 class PdfToEmfState; |
| 156 std::unique_ptr<PdfToEmfState> pdf_to_emf_state_; | 155 std::unique_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 |