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 <set> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
8 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
10 #include "chrome/common/media_galleries/picasa_types.h" | |
11 #include "content/public/utility/content_utility_client.h" | 14 #include "content/public/utility/content_utility_client.h" |
12 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
13 | 16 |
14 namespace base { | 17 namespace base { |
15 class FilePath; | 18 class FilePath; |
16 struct FileDescriptor; | 19 struct FileDescriptor; |
17 } | 20 } |
18 | 21 |
19 namespace metadata { | |
20 class MediaMetadataParser; | |
21 } | |
22 | |
23 class UtilityMessageHandler; | 22 class UtilityMessageHandler; |
24 | 23 |
25 class ChromeContentUtilityClient : public content::ContentUtilityClient { | 24 class ChromeContentUtilityClient : public content::ContentUtilityClient { |
26 public: | 25 public: |
27 ChromeContentUtilityClient(); | 26 ChromeContentUtilityClient(); |
28 virtual ~ChromeContentUtilityClient(); | 27 virtual ~ChromeContentUtilityClient(); |
29 | 28 |
30 virtual void UtilityThreadStarted() OVERRIDE; | 29 virtual void UtilityThreadStarted() OVERRIDE; |
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 30 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
32 | 31 |
33 static void PreSandboxStartup(); | 32 static void PreSandboxStartup(); |
34 | 33 |
| 34 // Shared with extensions::ExtensionsHandler. |
| 35 static void DecodeImage(const std::vector<unsigned char>& encoded_data); |
| 36 |
35 private: | 37 private: |
36 // IPC message handlers. | 38 // IPC message handlers. |
37 void OnUnpackExtension(const base::FilePath& extension_path, | |
38 const std::string& extension_id, | |
39 int location, int creation_flags); | |
40 void OnUnpackWebResource(const std::string& resource_data); | 39 void OnUnpackWebResource(const std::string& resource_data); |
41 void OnParseUpdateManifest(const std::string& xml); | |
42 void OnDecodeImage(const std::vector<unsigned char>& encoded_data); | 40 void OnDecodeImage(const std::vector<unsigned char>& encoded_data); |
43 void OnDecodeImageBase64(const std::string& encoded_data); | |
44 void OnRobustJPEGDecodeImage( | 41 void OnRobustJPEGDecodeImage( |
45 const std::vector<unsigned char>& encoded_data); | 42 const std::vector<unsigned char>& encoded_data); |
46 void OnParseJSON(const std::string& json); | |
47 | 43 |
48 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
49 void OnCreateZipFile(const base::FilePath& src_dir, | 45 void OnCreateZipFile(const base::FilePath& src_dir, |
50 const std::vector<base::FilePath>& src_relative_paths, | 46 const std::vector<base::FilePath>& src_relative_paths, |
51 const base::FileDescriptor& dest_fd); | 47 const base::FileDescriptor& dest_fd); |
52 #endif // defined(OS_CHROMEOS) | 48 #endif // defined(OS_CHROMEOS) |
53 | 49 |
54 void OnPatchFileBsdiff(const base::FilePath& input_file, | 50 void OnPatchFileBsdiff(const base::FilePath& input_file, |
55 const base::FilePath& patch_file, | 51 const base::FilePath& patch_file, |
56 const base::FilePath& output_file); | 52 const base::FilePath& output_file); |
57 void OnPatchFileCourgette(const base::FilePath& input_file, | 53 void OnPatchFileCourgette(const base::FilePath& input_file, |
58 const base::FilePath& patch_file, | 54 const base::FilePath& patch_file, |
59 const base::FilePath& output_file); | 55 const base::FilePath& output_file); |
60 void OnStartupPing(); | 56 void OnStartupPing(); |
61 void OnAnalyzeZipFileForDownloadProtection( | 57 void OnAnalyzeZipFileForDownloadProtection( |
62 const IPC::PlatformFileForTransit& zip_file); | 58 const IPC::PlatformFileForTransit& zip_file); |
63 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 59 #if defined(ENABLE_EXTENSIONS) |
64 void OnCheckMediaFile(int64 milliseconds_of_decoding, | 60 void OnParseMediaMetadata(const std::string& mime_type, |
65 const IPC::PlatformFileForTransit& media_file); | 61 int64 total_size, |
66 void OnParseMediaMetadata(const std::string& mime_type, int64 total_size, | |
67 bool get_attached_images); | 62 bool get_attached_images); |
68 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 63 #endif |
69 | |
70 #if defined(OS_WIN) | |
71 void OnParseITunesPrefXml(const std::string& itunes_xml_data); | |
72 #endif // defined(OS_WIN) | |
73 | |
74 #if defined(OS_MACOSX) | |
75 void OnParseIPhotoLibraryXmlFile( | |
76 const IPC::PlatformFileForTransit& iphoto_library_file); | |
77 #endif // defined(OS_MACOSX) | |
78 | |
79 #if defined(OS_WIN) || defined(OS_MACOSX) | |
80 void OnParseITunesLibraryXmlFile( | |
81 const IPC::PlatformFileForTransit& itunes_library_file); | |
82 | |
83 void OnParsePicasaPMPDatabase( | |
84 const picasa::AlbumTableFilesForTransit& album_table_files); | |
85 | |
86 void OnIndexPicasaAlbumsContents( | |
87 const picasa::AlbumUIDSet& album_uids, | |
88 const std::vector<picasa::FolderINIContents>& folders_inis); | |
89 #endif // defined(OS_WIN) || defined(OS_MACOSX) | |
90 | |
91 #if defined(OS_WIN) | |
92 void OnGetAndEncryptWiFiCredentials(const std::string& network_guid, | |
93 const std::vector<uint8>& public_key); | |
94 #endif // defined(OS_WIN) | |
95 | 64 |
96 typedef ScopedVector<UtilityMessageHandler> Handlers; | 65 typedef ScopedVector<UtilityMessageHandler> Handlers; |
97 Handlers handlers_; | 66 Handlers handlers_; |
98 | 67 |
99 // Flag to enable whitelisting. | 68 // Flag to enable whitelisting. |
100 bool filter_messages_; | 69 bool filter_messages_; |
101 // A list of message_ids to filter. | 70 // A list of message_ids to filter. |
102 std::set<int> message_id_whitelist_; | 71 std::set<int> message_id_whitelist_; |
103 | 72 |
104 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); | 73 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); |
105 }; | 74 }; |
106 | 75 |
107 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 76 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
OLD | NEW |