Clean up is_swapped_out references in RenderFrameImpl.
[chromium-blink-merge.git] / chrome / utility / chrome_content_utility_client.h
blob91ed9ff1b54e2f31fcdb30b3baf996e06ccfdab1
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 <set>
9 #include <string>
10 #include <vector>
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_vector.h"
14 #include "content/public/utility/content_utility_client.h"
15 #include "ipc/ipc_platform_file.h"
17 namespace base {
18 class FilePath;
19 struct FileDescriptor;
22 class UtilityMessageHandler;
24 class ChromeContentUtilityClient : public content::ContentUtilityClient {
25 public:
26 ChromeContentUtilityClient();
27 virtual ~ChromeContentUtilityClient();
29 void UtilityThreadStarted() override;
30 bool OnMessageReceived(const IPC::Message& message) override;
32 static void PreSandboxStartup();
34 // Shared with extensions::ExtensionsHandler.
35 static SkBitmap DecodeImage(const std::vector<unsigned char>& encoded_data,
36 bool shrink_to_fit);
37 static void DecodeImageAndSend(const std::vector<unsigned char>& encoded_data,
38 bool shrink_to_fit);
40 static void set_max_ipc_message_size_for_test(int64_t max_message_size) {
41 max_ipc_message_size_ = max_message_size;
44 private:
45 // IPC message handlers.
46 void OnUnpackWebResource(const std::string& resource_data);
47 void OnDecodeImage(const std::vector<unsigned char>& encoded_data,
48 bool shrink_to_fit);
49 void OnRobustJPEGDecodeImage(
50 const std::vector<unsigned char>& encoded_data);
52 #if defined(OS_CHROMEOS)
53 void OnCreateZipFile(const base::FilePath& src_dir,
54 const std::vector<base::FilePath>& src_relative_paths,
55 const base::FileDescriptor& dest_fd);
56 #endif // defined(OS_CHROMEOS)
58 void OnPatchFileBsdiff(const base::FilePath& input_file,
59 const base::FilePath& patch_file,
60 const base::FilePath& output_file);
61 void OnPatchFileCourgette(const base::FilePath& input_file,
62 const base::FilePath& patch_file,
63 const base::FilePath& output_file);
64 void OnStartupPing();
65 #if defined(FULL_SAFE_BROWSING)
66 void OnAnalyzeZipFileForDownloadProtection(
67 const IPC::PlatformFileForTransit& zip_file);
68 #endif
69 #if defined(ENABLE_EXTENSIONS)
70 void OnParseMediaMetadata(const std::string& mime_type,
71 int64 total_size,
72 bool get_attached_images);
73 #endif
75 typedef ScopedVector<UtilityMessageHandler> Handlers;
76 Handlers handlers_;
78 // Flag to enable whitelisting.
79 bool filter_messages_;
80 // A list of message_ids to filter.
81 std::set<int> message_id_whitelist_;
82 // Maximum IPC msg size (default to kMaximumMessageSize; override for testing)
83 static int64_t max_ipc_message_size_;
85 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient);
88 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_