| 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" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 // Invoked when a metafile file is ready. | 79 // Invoked when a metafile file is ready. |
| 80 // Returns true if metafile successfully loaded from |file|. | 80 // Returns true if metafile successfully loaded from |file|. |
| 81 bool MetafileAvailable(float scale_factor, base::File file); | 81 bool MetafileAvailable(float scale_factor, base::File file); |
| 82 | 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(Client); | 83 DISALLOW_COPY_AND_ASSIGN(Client); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 ServiceUtilityProcessHost(Client* client, | 86 ServiceUtilityProcessHost(Client* client, |
| 87 base::MessageLoopProxy* client_message_loop_proxy); | 87 base::MessageLoopProxy* client_message_loop_proxy); |
| 88 virtual ~ServiceUtilityProcessHost(); | 88 ~ServiceUtilityProcessHost() override; |
| 89 | 89 |
| 90 // Starts a process to render the specified pages in the given PDF file into | 90 // 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 | 91 // 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. | 92 // pages than the specified page ranges, it will render as many as available. |
| 93 bool StartRenderPDFPagesToMetafile( | 93 bool StartRenderPDFPagesToMetafile( |
| 94 const base::FilePath& pdf_path, | 94 const base::FilePath& pdf_path, |
| 95 const printing::PdfRenderSettings& render_settings); | 95 const printing::PdfRenderSettings& render_settings); |
| 96 | 96 |
| 97 // Starts a process to get capabilities and defaults for the specified | 97 // Starts a process to get capabilities and defaults for the specified |
| 98 // printer. Used on Windows to isolate the service process from printer driver | 98 // printer. Used on Windows to isolate the service process from printer driver |
| 99 // crashes by executing this in a separate process. The process does not run | 99 // crashes by executing this in a separate process. The process does not run |
| 100 // in a sandbox. | 100 // in a sandbox. |
| 101 bool StartGetPrinterCapsAndDefaults(const std::string& printer_name); | 101 bool StartGetPrinterCapsAndDefaults(const std::string& printer_name); |
| 102 | 102 |
| 103 // Starts a process to get capabilities and defaults for the specified | 103 // Starts a process to get capabilities and defaults for the specified |
| 104 // printer. Used on Windows to isolate the service process from printer driver | 104 // printer. Used on Windows to isolate the service process from printer driver |
| 105 // crashes by executing this in a separate process. The process does not run | 105 // crashes by executing this in a separate process. The process does not run |
| 106 // in a sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. | 106 // in a sandbox. Returns result as printing::PrinterSemanticCapsAndDefaults. |
| 107 bool StartGetPrinterSemanticCapsAndDefaults(const std::string& printer_name); | 107 bool StartGetPrinterSemanticCapsAndDefaults(const std::string& printer_name); |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 bool Send(IPC::Message* msg); | 110 bool Send(IPC::Message* msg); |
| 111 | 111 |
| 112 // Allows this method to be overridden for tests. | 112 // Allows this method to be overridden for tests. |
| 113 virtual base::FilePath GetUtilityProcessCmd(); | 113 virtual base::FilePath GetUtilityProcessCmd(); |
| 114 | 114 |
| 115 // ChildProcessHostDelegate implementation: | 115 // ChildProcessHostDelegate implementation: |
| 116 virtual void OnChildDisconnected() override; | 116 void OnChildDisconnected() override; |
| 117 virtual bool OnMessageReceived(const IPC::Message& message) override; | 117 bool OnMessageReceived(const IPC::Message& message) override; |
| 118 virtual const base::Process& GetProcess() const override; | 118 const base::Process& GetProcess() const override; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 // Starts a process. Returns true iff it succeeded. | 121 // Starts a process. Returns true iff it succeeded. |
| 122 bool StartProcess(bool no_sandbox); | 122 bool StartProcess(bool no_sandbox); |
| 123 | 123 |
| 124 // Launch the child process synchronously. | 124 // Launch the child process synchronously. |
| 125 bool Launch(base::CommandLine* cmd_line, bool no_sandbox); | 125 bool Launch(base::CommandLine* cmd_line, bool no_sandbox); |
| 126 | 126 |
| 127 base::ProcessHandle handle() const { return process_.Handle(); } | 127 base::ProcessHandle handle() const { return process_.Handle(); } |
| 128 | 128 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 154 | 154 |
| 155 class PdfToEmfState; | 155 class PdfToEmfState; |
| 156 scoped_ptr<PdfToEmfState> pdf_to_emf_state_; | 156 scoped_ptr<PdfToEmfState> pdf_to_emf_state_; |
| 157 | 157 |
| 158 base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_; | 158 base::WeakPtrFactory<ServiceUtilityProcessHost> weak_ptr_factory_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); | 160 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 163 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
| OLD | NEW |