| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 ~ChromeContentUtilityClient() override; | 31 ~ChromeContentUtilityClient() override; |
| 32 | 32 |
| 33 void UtilityThreadStarted() override; | 33 void UtilityThreadStarted() override; |
| 34 bool OnMessageReceived(const IPC::Message& message) override; | 34 bool OnMessageReceived(const IPC::Message& message) override; |
| 35 void RegisterMojoServices(content::ServiceRegistry* registry) override; | 35 void RegisterMojoServices(content::ServiceRegistry* registry) override; |
| 36 | 36 |
| 37 void AddHandler(scoped_ptr<UtilityMessageHandler> handler); | 37 void AddHandler(scoped_ptr<UtilityMessageHandler> handler); |
| 38 | 38 |
| 39 static void PreSandboxStartup(); | 39 static void PreSandboxStartup(); |
| 40 | 40 |
| 41 // Shared with extensions::ExtensionsHandler. | |
| 42 static SkBitmap DecodeImage(const std::vector<unsigned char>& encoded_data, | |
| 43 bool shrink_to_fit); | |
| 44 static void DecodeImageAndSend(const std::vector<unsigned char>& encoded_data, | |
| 45 bool shrink_to_fit, | |
| 46 int request_id); | |
| 47 | |
| 48 static void set_max_ipc_message_size_for_test(int64_t max_message_size) { | |
| 49 max_ipc_message_size_ = max_message_size; | |
| 50 } | |
| 51 | |
| 52 private: | 41 private: |
| 53 // IPC message handlers. | 42 // IPC message handlers. |
| 54 void OnUnpackWebResource(const std::string& resource_data); | 43 void OnUnpackWebResource(const std::string& resource_data); |
| 55 void OnDecodeImage(const std::vector<unsigned char>& encoded_data, | |
| 56 bool shrink_to_fit, | |
| 57 int request_id); | |
| 58 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 59 void OnRobustJPEGDecodeImage(const std::vector<unsigned char>& encoded_data, | |
| 60 int request_id); | |
| 61 void OnRobustPNGDecodeImage(const std::vector<unsigned char>& encoded_data, | |
| 62 int request_id); | |
| 63 | |
| 64 void OnCreateZipFile(const base::FilePath& src_dir, | 45 void OnCreateZipFile(const base::FilePath& src_dir, |
| 65 const std::vector<base::FilePath>& src_relative_paths, | 46 const std::vector<base::FilePath>& src_relative_paths, |
| 66 const base::FileDescriptor& dest_fd); | 47 const base::FileDescriptor& dest_fd); |
| 67 #endif // defined(OS_CHROMEOS) | 48 #endif // defined(OS_CHROMEOS) |
| 68 | 49 |
| 69 void OnPatchFileBsdiff(const base::FilePath& input_file, | 50 void OnPatchFileBsdiff(const base::FilePath& input_file, |
| 70 const base::FilePath& patch_file, | 51 const base::FilePath& patch_file, |
| 71 const base::FilePath& output_file); | 52 const base::FilePath& output_file); |
| 72 void OnPatchFileCourgette(const base::FilePath& input_file, | 53 void OnPatchFileCourgette(const base::FilePath& input_file, |
| 73 const base::FilePath& patch_file, | 54 const base::FilePath& patch_file, |
| 74 const base::FilePath& output_file); | 55 const base::FilePath& output_file); |
| 75 void OnStartupPing(); | 56 void OnStartupPing(); |
| 76 #if defined(FULL_SAFE_BROWSING) | 57 #if defined(FULL_SAFE_BROWSING) |
| 77 void OnAnalyzeZipFileForDownloadProtection( | 58 void OnAnalyzeZipFileForDownloadProtection( |
| 78 const IPC::PlatformFileForTransit& zip_file, | 59 const IPC::PlatformFileForTransit& zip_file, |
| 79 const IPC::PlatformFileForTransit& temp_file); | 60 const IPC::PlatformFileForTransit& temp_file); |
| 80 #if defined(OS_MACOSX) | 61 #if defined(OS_MACOSX) |
| 81 void OnAnalyzeDmgFileForDownloadProtection( | 62 void OnAnalyzeDmgFileForDownloadProtection( |
| 82 const IPC::PlatformFileForTransit& dmg_file); | 63 const IPC::PlatformFileForTransit& dmg_file); |
| 83 #endif // defined(OS_MACOSX) | 64 #endif // defined(OS_MACOSX) |
| 84 #endif // defined(FULL_SAFE_BROWSING) | 65 #endif // defined(FULL_SAFE_BROWSING) |
| 85 | 66 |
| 86 typedef ScopedVector<UtilityMessageHandler> Handlers; | 67 typedef ScopedVector<UtilityMessageHandler> Handlers; |
| 87 Handlers handlers_; | 68 Handlers handlers_; |
| 88 | 69 |
| 89 // Flag to enable whitelisting. | 70 // Flag to enable whitelisting. |
| 90 bool filter_messages_; | 71 bool filter_messages_; |
| 91 // A list of message_ids to filter. | 72 // A list of message_ids to filter. |
| 92 std::set<int> message_id_whitelist_; | 73 std::set<int> message_id_whitelist_; |
| 93 // Maximum IPC msg size (default to kMaximumMessageSize; override for testing) | |
| 94 static int64_t max_ipc_message_size_; | |
| 95 | 74 |
| 96 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); | 75 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient); |
| 97 }; | 76 }; |
| 98 | 77 |
| 99 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ | 78 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_ |
| OLD | NEW |