Fire an error if a pref used in the UI is missing once all prefs are fetched.
[chromium-blink-merge.git] / chrome / utility / chrome_content_utility_client.h
blobf2eee64331e8188c2265647d196bc487379fc8eb
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 ~ChromeContentUtilityClient() override;
29 void UtilityThreadStarted() override;
30 bool OnMessageReceived(const IPC::Message& message) override;
31 void RegisterMojoServices(content::ServiceRegistry* registry) override;
33 static void PreSandboxStartup();
35 // Shared with extensions::ExtensionsHandler.
36 static SkBitmap DecodeImage(const std::vector<unsigned char>& encoded_data,
37 bool shrink_to_fit);
38 static void DecodeImageAndSend(const std::vector<unsigned char>& encoded_data,
39 bool shrink_to_fit);
41 static void set_max_ipc_message_size_for_test(int64_t max_message_size) {
42 max_ipc_message_size_ = max_message_size;
45 private:
46 // IPC message handlers.
47 void OnUnpackWebResource(const std::string& resource_data);
48 void OnDecodeImage(const std::vector<unsigned char>& encoded_data,
49 bool shrink_to_fit);
50 void OnRobustJPEGDecodeImage(
51 const std::vector<unsigned char>& encoded_data);
53 #if defined(OS_CHROMEOS)
54 void OnCreateZipFile(const base::FilePath& src_dir,
55 const std::vector<base::FilePath>& src_relative_paths,
56 const base::FileDescriptor& dest_fd);
57 #endif // defined(OS_CHROMEOS)
59 #if defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
60 void OnDetectSeccompSupport();
61 #endif
63 void OnParseJSON(const std::string& json);
64 void OnPatchFileBsdiff(const base::FilePath& input_file,
65 const base::FilePath& patch_file,
66 const base::FilePath& output_file);
67 void OnPatchFileCourgette(const base::FilePath& input_file,
68 const base::FilePath& patch_file,
69 const base::FilePath& output_file);
70 void OnStartupPing();
71 #if defined(FULL_SAFE_BROWSING)
72 void OnAnalyzeZipFileForDownloadProtection(
73 const IPC::PlatformFileForTransit& zip_file,
74 const IPC::PlatformFileForTransit& temp_file);
75 #endif
76 #if defined(ENABLE_EXTENSIONS)
77 void OnParseMediaMetadata(const std::string& mime_type,
78 int64 total_size,
79 bool get_attached_images);
80 #endif
82 typedef ScopedVector<UtilityMessageHandler> Handlers;
83 Handlers handlers_;
85 // Flag to enable whitelisting.
86 bool filter_messages_;
87 // A list of message_ids to filter.
88 std::set<int> message_id_whitelist_;
89 // Maximum IPC msg size (default to kMaximumMessageSize; override for testing)
90 static int64_t max_ipc_message_size_;
92 DISALLOW_COPY_AND_ASSIGN(ChromeContentUtilityClient);
95 #endif // CHROME_UTILITY_CHROME_CONTENT_UTILITY_CLIENT_H_