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_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 5 #ifndef CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
6 #define CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 6 #define CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
11 #include "chrome/common/media_galleries/picasa_types.h" | 11 #include "chrome/common/media_galleries/picasa_types.h" |
12 #include "content/public/utility/content_utility_client.h" | 12 #include "content/public/utility/content_utility_client.h" |
13 #include "ipc/ipc_platform_file.h" | 13 #include "ipc/ipc_platform_file.h" |
14 #include "printing/pdf_render_settings.h" | |
15 | 14 |
16 namespace base { | 15 namespace base { |
17 class FilePath; | 16 class FilePath; |
18 struct FileDescriptor; | 17 struct FileDescriptor; |
19 } | 18 } |
20 | 19 |
21 namespace gfx { | 20 namespace gfx { |
22 class Rect; | 21 class Rect; |
23 } | 22 } |
24 | 23 |
25 namespace printing { | 24 namespace printing { |
| 25 class PdfRenderSettings; |
26 struct PageRange; | 26 struct PageRange; |
27 } | 27 } |
28 | 28 |
29 namespace chrome { | 29 namespace chrome { |
30 | 30 |
31 class UtilityMessageHandler; | 31 class UtilityMessageHandler; |
32 | 32 |
33 class ChromeContentUtilityClient : public content::ContentUtilityClient { | 33 class ChromeContentUtilityClient : public content::ContentUtilityClient { |
34 public: | 34 public: |
35 ChromeContentUtilityClient(); | 35 ChromeContentUtilityClient(); |
36 virtual ~ChromeContentUtilityClient(); | 36 virtual ~ChromeContentUtilityClient(); |
37 | 37 |
38 virtual void UtilityThreadStarted() OVERRIDE; | 38 virtual void UtilityThreadStarted() OVERRIDE; |
39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 39 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
40 | 40 |
41 static void PreSandboxStartup(); | 41 static void PreSandboxStartup(); |
42 | 42 |
43 private: | 43 private: |
44 // IPC message handlers. | 44 // IPC message handlers. |
45 void OnUnpackExtension(const base::FilePath& extension_path, | 45 void OnUnpackExtension(const base::FilePath& extension_path, |
46 const std::string& extension_id, | 46 const std::string& extension_id, |
47 int location, int creation_flags); | 47 int location, int creation_flags); |
48 void OnUnpackWebResource(const std::string& resource_data); | 48 void OnUnpackWebResource(const std::string& resource_data); |
49 void OnParseUpdateManifest(const std::string& xml); | 49 void OnParseUpdateManifest(const std::string& xml); |
50 void OnDecodeImage(const std::vector<unsigned char>& encoded_data); | 50 void OnDecodeImage(const std::vector<unsigned char>& encoded_data); |
51 void OnDecodeImageBase64(const std::string& encoded_data); | 51 void OnDecodeImageBase64(const std::string& encoded_data); |
52 void OnRenderPDFPagesToMetafile( | 52 void OnRenderPDFPagesToMetafile( |
53 base::PlatformFile pdf_file, | 53 base::PlatformFile pdf_file, |
54 const base::FilePath& metafile_path, | 54 const base::FilePath& metafile_path, |
55 const printing::PdfRenderSettings& pdf_render_settings, | 55 const printing::PdfRenderSettings& settings, |
56 const std::vector<printing::PageRange>& page_ranges); | 56 const std::vector<printing::PageRange>& page_ranges); |
57 void OnRobustJPEGDecodeImage( | 57 void OnRobustJPEGDecodeImage( |
58 const std::vector<unsigned char>& encoded_data); | 58 const std::vector<unsigned char>& encoded_data); |
59 void OnParseJSON(const std::string& json); | 59 void OnParseJSON(const std::string& json); |
60 | 60 |
61 #if defined(OS_CHROMEOS) | 61 #if defined(OS_CHROMEOS) |
62 void OnCreateZipFile(const base::FilePath& src_dir, | 62 void OnCreateZipFile(const base::FilePath& src_dir, |
63 const std::vector<base::FilePath>& src_relative_paths, | 63 const std::vector<base::FilePath>& src_relative_paths, |
64 const base::FileDescriptor& dest_fd); | 64 const base::FileDescriptor& dest_fd); |
65 #endif // defined(OS_CHROMEOS) | 65 #endif // defined(OS_CHROMEOS) |
66 | 66 |
67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
68 // Helper method for Windows. | 68 // Helper method for Windows. |
69 // |highest_rendered_page_number| is set to -1 on failure to render any page. | 69 // |highest_rendered_page_number| is set to -1 on failure to render any page. |
70 bool RenderPDFToWinMetafile( | 70 bool RenderPDFToWinMetafile( |
71 base::PlatformFile pdf_file, | 71 base::PlatformFile pdf_file, |
72 const base::FilePath& metafile_path, | 72 const base::FilePath& metafile_path, |
73 const gfx::Rect& render_area, | 73 const printing::PdfRenderSettings& settings, |
74 int render_dpi, | |
75 bool autorotate, | |
76 const std::vector<printing::PageRange>& page_ranges, | 74 const std::vector<printing::PageRange>& page_ranges, |
77 int* highest_rendered_page_number, | 75 int* highest_rendered_page_number, |
78 double* scale_factor); | 76 double* scale_factor); |
79 #endif // defined(OS_WIN) | 77 #endif // defined(OS_WIN) |
80 | 78 |
81 void OnGetPrinterCapsAndDefaults(const std::string& printer_name); | 79 void OnGetPrinterCapsAndDefaults(const std::string& printer_name); |
82 void OnStartupPing(); | 80 void OnStartupPing(); |
83 void OnAnalyzeZipFileForDownloadProtection( | 81 void OnAnalyzeZipFileForDownloadProtection( |
84 const IPC::PlatformFileForTransit& zip_file); | 82 const IPC::PlatformFileForTransit& zip_file); |
85 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 83 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
(...skipping 24 matching lines...) Expand all Loading... |
110 | 108 |
111 typedef ScopedVector<UtilityMessageHandler> Handlers; | 109 typedef ScopedVector<UtilityMessageHandler> Handlers; |
112 Handlers handlers_; | 110 Handlers handlers_; |
113 | 111 |
114 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); | 112 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); |
115 }; | 113 }; |
116 | 114 |
117 } // namespace chrome | 115 } // namespace chrome |
118 | 116 |
119 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 117 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
OLD | NEW |