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/files/file.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
12 #include "chrome/common/media_galleries/picasa_types.h" | 10 #include "chrome/common/media_galleries/picasa_types.h" |
13 #include "content/public/utility/content_utility_client.h" | 11 #include "content/public/utility/content_utility_client.h" |
14 #include "ipc/ipc_platform_file.h" | 12 #include "ipc/ipc_platform_file.h" |
15 | 13 |
16 namespace base { | 14 namespace base { |
17 class FilePath; | 15 class FilePath; |
18 struct FileDescriptor; | 16 struct FileDescriptor; |
19 } | 17 } |
20 | 18 |
21 namespace gfx { | |
22 class Rect; | |
23 } | |
24 | |
25 namespace metadata { | 19 namespace metadata { |
26 class MediaMetadataParser; | 20 class MediaMetadataParser; |
27 } | 21 } |
28 | 22 |
29 namespace printing { | |
30 class PdfRenderSettings; | |
31 struct PwgRasterSettings; | |
32 struct PageRange; | |
33 } | |
34 | |
35 namespace chrome { | |
36 | |
37 class UtilityMessageHandler; | 23 class UtilityMessageHandler; |
38 | 24 |
39 class ChromeContentUtilityClient : public content::ContentUtilityClient { | 25 class ChromeContentUtilityClient : public content::ContentUtilityClient { |
40 public: | 26 public: |
41 ChromeContentUtilityClient(); | 27 ChromeContentUtilityClient(); |
42 virtual ~ChromeContentUtilityClient(); | 28 virtual ~ChromeContentUtilityClient(); |
43 | 29 |
44 virtual void UtilityThreadStarted() OVERRIDE; | 30 virtual void UtilityThreadStarted() OVERRIDE; |
45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
46 | 32 |
47 static void PreSandboxStartup(); | 33 static void PreSandboxStartup(); |
48 | 34 |
49 private: | 35 private: |
50 // IPC message handlers. | 36 // IPC message handlers. |
51 void OnUnpackExtension(const base::FilePath& extension_path, | 37 void OnUnpackExtension(const base::FilePath& extension_path, |
52 const std::string& extension_id, | 38 const std::string& extension_id, |
53 int location, int creation_flags); | 39 int location, int creation_flags); |
54 void OnUnpackWebResource(const std::string& resource_data); | 40 void OnUnpackWebResource(const std::string& resource_data); |
55 void OnParseUpdateManifest(const std::string& xml); | 41 void OnParseUpdateManifest(const std::string& xml); |
56 void OnDecodeImage(const std::vector<unsigned char>& encoded_data); | 42 void OnDecodeImage(const std::vector<unsigned char>& encoded_data); |
57 void OnDecodeImageBase64(const std::string& encoded_data); | 43 void OnDecodeImageBase64(const std::string& encoded_data); |
58 void OnRenderPDFPagesToMetafile( | |
59 IPC::PlatformFileForTransit pdf_transit, | |
60 const base::FilePath& metafile_path, | |
61 const printing::PdfRenderSettings& settings, | |
62 const std::vector<printing::PageRange>& page_ranges); | |
63 void OnRenderPDFPagesToPWGRaster( | |
64 IPC::PlatformFileForTransit pdf_transit, | |
65 const printing::PdfRenderSettings& settings, | |
66 const printing::PwgRasterSettings& bitmap_settings, | |
67 IPC::PlatformFileForTransit bitmap_transit); | |
68 void OnRobustJPEGDecodeImage( | 44 void OnRobustJPEGDecodeImage( |
69 const std::vector<unsigned char>& encoded_data); | 45 const std::vector<unsigned char>& encoded_data); |
70 void OnParseJSON(const std::string& json); | 46 void OnParseJSON(const std::string& json); |
71 | 47 |
72 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
73 void OnCreateZipFile(const base::FilePath& src_dir, | 49 void OnCreateZipFile(const base::FilePath& src_dir, |
74 const std::vector<base::FilePath>& src_relative_paths, | 50 const std::vector<base::FilePath>& src_relative_paths, |
75 const base::FileDescriptor& dest_fd); | 51 const base::FileDescriptor& dest_fd); |
76 #endif // defined(OS_CHROMEOS) | 52 #endif // defined(OS_CHROMEOS) |
77 | 53 |
78 #if defined(OS_WIN) | |
79 // Helper method for Windows. | |
80 // |highest_rendered_page_number| is set to -1 on failure to render any page. | |
81 // |page_ranges| is both input and output. If supplied as input, only the | |
82 // specified pages will be rendered. If an empty vector is supplied it will | |
83 // be filled with a range of all pages that were rendered. | |
84 bool RenderPDFToWinMetafile( | |
85 base::File pdf_file, | |
86 const base::FilePath& metafile_path, | |
87 const printing::PdfRenderSettings& settings, | |
88 std::vector<printing::PageRange>* page_ranges, | |
89 int* highest_rendered_page_number, | |
90 double* scale_factor); | |
91 #endif // defined(OS_WIN) | |
92 | |
93 bool RenderPDFPagesToPWGRaster( | |
94 base::File pdf_file, | |
95 const printing::PdfRenderSettings& settings, | |
96 const printing::PwgRasterSettings& bitmap_settings, | |
97 base::File bitmap_file); | |
98 | |
99 void OnGetPrinterCapsAndDefaults(const std::string& printer_name); | |
100 void OnGetPrinterSemanticCapsAndDefaults(const std::string& printer_name); | |
101 void OnPatchFileBsdiff(const base::FilePath& input_file, | 54 void OnPatchFileBsdiff(const base::FilePath& input_file, |
102 const base::FilePath& patch_file, | 55 const base::FilePath& patch_file, |
103 const base::FilePath& output_file); | 56 const base::FilePath& output_file); |
104 void OnPatchFileCourgette(const base::FilePath& input_file, | 57 void OnPatchFileCourgette(const base::FilePath& input_file, |
105 const base::FilePath& patch_file, | 58 const base::FilePath& patch_file, |
106 const base::FilePath& output_file); | 59 const base::FilePath& output_file); |
107 void OnStartupPing(); | 60 void OnStartupPing(); |
108 void OnAnalyzeZipFileForDownloadProtection( | 61 void OnAnalyzeZipFileForDownloadProtection( |
109 const IPC::PlatformFileForTransit& zip_file); | 62 const IPC::PlatformFileForTransit& zip_file); |
110 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 63 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Handlers handlers_; | 97 Handlers handlers_; |
145 | 98 |
146 // Flag to enable whitelisting. | 99 // Flag to enable whitelisting. |
147 bool filter_messages_; | 100 bool filter_messages_; |
148 // A list of message_ids to filter. | 101 // A list of message_ids to filter. |
149 std::set<int> message_id_whitelist_; | 102 std::set<int> message_id_whitelist_; |
150 | 103 |
151 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); | 104 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); |
152 }; | 105 }; |
153 | 106 |
154 } // namespace chrome | |
155 | |
156 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 107 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
OLD | NEW |