NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / utility / chrome_content_utility_client.h
blobfcc5da9b8c8cf82e863f761d55a44ef4b3c188ed
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
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_
6 #define CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/scoped_vector.h"
11 #include "base/platform_file.h"
12 #include "chrome/common/media_galleries/picasa_types.h"
13 #include "content/public/utility/content_utility_client.h"
14 #include "ipc/ipc_platform_file.h"
16 namespace base {
17 class FilePath;
18 struct FileDescriptor;
21 namespace gfx {
22 class Rect;
25 namespace metadata {
26 class MediaMetadataParser;
29 namespace printing {
30 class PdfRenderSettings;
31 struct PageRange;
34 namespace chrome {
36 class UtilityMessageHandler;
38 class ChromeContentUtilityClient : public content::ContentUtilityClient {
39 public:
40 ChromeContentUtilityClient();
41 virtual ~ChromeContentUtilityClient();
43 virtual void UtilityThreadStarted() OVERRIDE;
44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
46 static void PreSandboxStartup();
48 private:
49 // IPC message handlers.
50 void OnUnpackExtension(const base::FilePath& extension_path,
51 const std::string& extension_id,
52 int location, int creation_flags);
53 void OnUnpackWebResource(const std::string& resource_data);
54 void OnParseUpdateManifest(const std::string& xml);
55 void OnDecodeImage(const std::vector<unsigned char>& encoded_data);
56 void OnDecodeImageBase64(const std::string& encoded_data);
57 void OnRenderPDFPagesToMetafile(
58 base::PlatformFile pdf_file,
59 const base::FilePath& metafile_path,
60 const printing::PdfRenderSettings& settings,
61 const std::vector<printing::PageRange>& page_ranges);
62 void OnRenderPDFPagesToPWGRaster(
63 IPC::PlatformFileForTransit pdf_transit,
64 const printing::PdfRenderSettings& settings,
65 IPC::PlatformFileForTransit bitmap_transit);
66 void OnRobustJPEGDecodeImage(
67 const std::vector<unsigned char>& encoded_data);
68 void OnParseJSON(const std::string& json);
70 #if defined(OS_CHROMEOS)
71 void OnCreateZipFile(const base::FilePath& src_dir,
72 const std::vector<base::FilePath>& src_relative_paths,
73 const base::FileDescriptor& dest_fd);
74 #endif // defined(OS_CHROMEOS)
76 #if defined(OS_WIN)
77 // Helper method for Windows.
78 // |highest_rendered_page_number| is set to -1 on failure to render any page.
79 bool RenderPDFToWinMetafile(
80 base::PlatformFile pdf_file,
81 const base::FilePath& metafile_path,
82 const printing::PdfRenderSettings& settings,
83 const std::vector<printing::PageRange>& page_ranges,
84 int* highest_rendered_page_number,
85 double* scale_factor);
86 #endif // defined(OS_WIN)
88 bool RenderPDFPagesToPWGRaster(
89 base::PlatformFile pdf_file,
90 const printing::PdfRenderSettings& settings,
91 base::PlatformFile bitmap_file);
93 void OnGetPrinterCapsAndDefaults(const std::string& printer_name);
94 void OnGetPrinterSemanticCapsAndDefaults(const std::string& printer_name);
95 void OnStartupPing();
96 void OnAnalyzeZipFileForDownloadProtection(
97 const IPC::PlatformFileForTransit& zip_file);
98 #if !defined(OS_ANDROID) && !defined(OS_IOS)
99 void OnCheckMediaFile(int64 milliseconds_of_decoding,
100 const IPC::PlatformFileForTransit& media_file);
101 void OnParseMediaMetadata(const std::string& mime_type, int64 total_size);
102 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
104 #if defined(OS_WIN)
105 void OnParseITunesPrefXml(const std::string& itunes_xml_data);
106 #endif // defined(OS_WIN)
108 #if defined(OS_MACOSX)
109 void OnParseIPhotoLibraryXmlFile(
110 const IPC::PlatformFileForTransit& iphoto_library_file);
111 #endif // defined(OS_MACOSX)
113 #if defined(OS_WIN) || defined(OS_MACOSX)
114 void OnParseITunesLibraryXmlFile(
115 const IPC::PlatformFileForTransit& itunes_library_file);
117 void OnParsePicasaPMPDatabase(
118 const picasa::AlbumTableFilesForTransit& album_table_files);
120 void OnIndexPicasaAlbumsContents(
121 const picasa::AlbumUIDSet& album_uids,
122 const std::vector<picasa::FolderINIContents>& folders_inis);
123 #endif // defined(OS_WIN) || defined(OS_MACOSX)
125 typedef ScopedVector<UtilityMessageHandler> Handlers;
126 Handlers handlers_;
128 #if !defined(OS_ANDROID) && !defined(OS_IOS)
129 scoped_ptr<metadata::MediaMetadataParser> media_metadata_parser_;
130 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
132 // Flag to enable whitelisting.
133 bool filter_messages_;
134 // A list of message_ids to filter.
135 std::set<int> message_id_whitelist_;
137 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient);
140 } // namespace chrome
142 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_