OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <windows.h> | 12 #include <windows.h> |
13 #endif // defined(OS_WIN) | 13 #endif // defined(OS_WIN) |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 #include "base/file_path.h" | 19 #include "base/file_path.h" |
20 #include "base/ref_counted.h" | 20 #include "base/ref_counted.h" |
21 #include "base/task.h" | 21 #include "base/task.h" |
22 #include "ipc/ipc_channel.h" | 22 #include "ipc/ipc_channel.h" |
23 #include "chrome/service/service_child_process_host.h" | 23 #include "chrome/service/service_child_process_host.h" |
24 #include "printing/native_metafile.h" | |
25 | 24 |
26 class CommandLine; | 25 class CommandLine; |
27 class ScopedTempDir; | 26 class ScopedTempDir; |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class MessageLoopProxy; | 29 class MessageLoopProxy; |
31 } // namespace base | 30 } // namespace base |
32 | 31 |
33 namespace gfx { | 32 namespace gfx { |
34 class Rect; | 33 class Rect; |
35 } // namespace gfx | 34 } // namespace gfx |
36 | 35 |
37 namespace printing { | 36 namespace printing { |
| 37 class Emf; |
38 struct PageRange; | 38 struct PageRange; |
39 struct PrinterCapsAndDefaults; | 39 struct PrinterCapsAndDefaults; |
40 } // namespace printing | 40 } // namespace printing |
41 | 41 |
42 // Acts as the service-side host to a utility child process. A | 42 // Acts as the service-side host to a utility child process. A |
43 // utility process is a short-lived sandboxed process that is created to run | 43 // utility process is a short-lived sandboxed process that is created to run |
44 // a specific task. | 44 // a specific task. |
45 class ServiceUtilityProcessHost : public ServiceChildProcessHost { | 45 class ServiceUtilityProcessHost : public ServiceChildProcessHost { |
46 public: | 46 public: |
47 // Consumers of ServiceUtilityProcessHost must implement this interface to | 47 // Consumers of ServiceUtilityProcessHost must implement this interface to |
48 // get results back. All functions are called on the thread passed along | 48 // get results back. All functions are called on the thread passed along |
49 // to ServiceUtilityProcessHost. | 49 // to ServiceUtilityProcessHost. |
50 class Client : public base::RefCountedThreadSafe<Client> { | 50 class Client : public base::RefCountedThreadSafe<Client> { |
51 public: | 51 public: |
52 Client() {} | 52 Client() {} |
53 | 53 |
54 // Called when the child process died before a reply was receieved. | 54 // Called when the child process died before a reply was receieved. |
55 virtual void OnChildDied() {} | 55 virtual void OnChildDied() {} |
56 | 56 |
57 // Called when at least one page in the specified PDF has been rendered | 57 // Called when at least one page in the specified PDF has been rendered |
58 // successfully into |metafile|. | 58 // successfully into |metafile|. |
59 virtual void OnRenderPDFPagesToMetafileSucceeded( | 59 virtual void OnRenderPDFPagesToMetafileSucceeded( |
60 const printing::NativeMetafile& metafile, | 60 const printing::Emf& metafile, |
61 int highest_rendered_page_number) {} | 61 int highest_rendered_page_number) {} |
62 // Called when no page in the passed in PDF could be rendered. | 62 // Called when no page in the passed in PDF could be rendered. |
63 virtual void OnRenderPDFPagesToMetafileFailed() {} | 63 virtual void OnRenderPDFPagesToMetafileFailed() {} |
64 | 64 |
65 // Called when the printer capabilities and defaults have been | 65 // Called when the printer capabilities and defaults have been |
66 // retrieved successfully. | 66 // retrieved successfully. |
67 virtual void OnGetPrinterCapsAndDefaultsSucceeded( | 67 virtual void OnGetPrinterCapsAndDefaultsSucceeded( |
68 const std::string& printer_name, | 68 const std::string& printer_name, |
69 const printing::PrinterCapsAndDefaults& caps_and_defaults) {} | 69 const printing::PrinterCapsAndDefaults& caps_and_defaults) {} |
70 | 70 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |