| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 virtual void OnGetPrinterCapsAndDefaultsFailed( | 73 virtual void OnGetPrinterCapsAndDefaultsFailed( |
| 74 const std::string& printer_name) {} | 74 const std::string& printer_name) {} |
| 75 | 75 |
| 76 protected: | 76 protected: |
| 77 virtual ~Client() {} | 77 virtual ~Client() {} |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 friend class base::RefCountedThreadSafe<Client>; | 80 friend class base::RefCountedThreadSafe<Client>; |
| 81 friend class ServiceUtilityProcessHost; | 81 friend class ServiceUtilityProcessHost; |
| 82 | 82 |
| 83 void OnMessageReceived(const IPC::Message& message); | 83 bool OnMessageReceived(const IPC::Message& message); |
| 84 // Invoked when a metafile file is ready. | 84 // Invoked when a metafile file is ready. |
| 85 void MetafileAvailable(const FilePath& metafile_path, | 85 void MetafileAvailable(const FilePath& metafile_path, |
| 86 int highest_rendered_page_number); | 86 int highest_rendered_page_number); |
| 87 | 87 |
| 88 DISALLOW_COPY_AND_ASSIGN(Client); | 88 DISALLOW_COPY_AND_ASSIGN(Client); |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 ServiceUtilityProcessHost(Client* client, | 91 ServiceUtilityProcessHost(Client* client, |
| 92 base::MessageLoopProxy* client_message_loop_proxy); | 92 base::MessageLoopProxy* client_message_loop_proxy); |
| 93 virtual ~ServiceUtilityProcessHost(); | 93 virtual ~ServiceUtilityProcessHost(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 115 virtual bool CanShutdown(); | 115 virtual bool CanShutdown(); |
| 116 virtual void OnChildDied(); | 116 virtual void OnChildDied(); |
| 117 | 117 |
| 118 private: | 118 private: |
| 119 // Starts a process. Returns true iff it succeeded. |exposed_dir| is the | 119 // Starts a process. Returns true iff it succeeded. |exposed_dir| is the |
| 120 // path to tbe exposed to the sandbox. This is ignored if |no_sandbox| is | 120 // path to tbe exposed to the sandbox. This is ignored if |no_sandbox| is |
| 121 // true. | 121 // true. |
| 122 bool StartProcess(bool no_sandbox, const FilePath& exposed_dir); | 122 bool StartProcess(bool no_sandbox, const FilePath& exposed_dir); |
| 123 | 123 |
| 124 // IPC messages: | 124 // IPC messages: |
| 125 virtual void OnMessageReceived(const IPC::Message& message); | 125 virtual bool OnMessageReceived(const IPC::Message& message); |
| 126 // Called when at least one page in the specified PDF has been rendered | 126 // Called when at least one page in the specified PDF has been rendered |
| 127 // successfully into metafile_path_; | 127 // successfully into metafile_path_; |
| 128 void OnRenderPDFPagesToMetafileSucceeded(int highest_rendered_page_number); | 128 void OnRenderPDFPagesToMetafileSucceeded(int highest_rendered_page_number); |
| 129 // Any other messages to be handled by the client. | 129 // Any other messages to be handled by the client. |
| 130 bool MessageForClient(const IPC::Message& message); | 130 bool MessageForClient(const IPC::Message& message); |
| 131 | 131 |
| 132 #if defined(OS_WIN) // This hack is Windows-specific. | 132 #if defined(OS_WIN) // This hack is Windows-specific. |
| 133 void OnPreCacheFont(LOGFONT font); | 133 void OnPreCacheFont(LOGFONT font); |
| 134 #endif // defined(OS_WIN) | 134 #endif // defined(OS_WIN) |
| 135 | 135 |
| 136 // A pointer to our client interface, who will be informed of progress. | 136 // A pointer to our client interface, who will be informed of progress. |
| 137 scoped_refptr<Client> client_; | 137 scoped_refptr<Client> client_; |
| 138 scoped_refptr<base::MessageLoopProxy> client_message_loop_proxy_; | 138 scoped_refptr<base::MessageLoopProxy> client_message_loop_proxy_; |
| 139 bool waiting_for_reply_; | 139 bool waiting_for_reply_; |
| 140 // The path to the temp file where the metafile will be written to. | 140 // The path to the temp file where the metafile will be written to. |
| 141 FilePath metafile_path_; | 141 FilePath metafile_path_; |
| 142 // The temporary folder created for the metafile. | 142 // The temporary folder created for the metafile. |
| 143 scoped_ptr<ScopedTempDir> scratch_metafile_dir_; | 143 scoped_ptr<ScopedTempDir> scratch_metafile_dir_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); | 145 DISALLOW_COPY_AND_ASSIGN(ServiceUtilityProcessHost); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ | 148 #endif // CHROME_SERVICE_SERVICE_UTILITY_PROCESS_HOST_H_ |
| OLD | NEW |