Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: chrome/utility/chrome_content_utility_client.cc

Issue 1018953004: Add SeccompSupportDetector for Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More GN Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/utility/chrome_content_utility_client.h" 5 #include "chrome/utility/chrome_content_utility_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 13 matching lines...) Expand all
24 #include "third_party/skia/include/core/SkBitmap.h" 24 #include "third_party/skia/include/core/SkBitmap.h"
25 #include "third_party/zlib/google/zip.h" 25 #include "third_party/zlib/google/zip.h"
26 #include "ui/gfx/codec/jpeg_codec.h" 26 #include "ui/gfx/codec/jpeg_codec.h"
27 #include "ui/gfx/geometry/size.h" 27 #include "ui/gfx/geometry/size.h"
28 28
29 #if !defined(OS_ANDROID) 29 #if !defined(OS_ANDROID)
30 #include "chrome/utility/profile_import_handler.h" 30 #include "chrome/utility/profile_import_handler.h"
31 #include "net/proxy/mojo_proxy_resolver_factory_impl.h" 31 #include "net/proxy/mojo_proxy_resolver_factory_impl.h"
32 #endif 32 #endif
33 33
34 #if defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
35 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h"
36 #endif
37
34 #if defined(OS_WIN) 38 #if defined(OS_WIN)
35 #include "chrome/utility/font_cache_handler_win.h" 39 #include "chrome/utility/font_cache_handler_win.h"
36 #include "chrome/utility/shell_handler_win.h" 40 #include "chrome/utility/shell_handler_win.h"
37 #endif 41 #endif
38 42
39 #if defined(ENABLE_EXTENSIONS) 43 #if defined(ENABLE_EXTENSIONS)
40 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" 44 #include "chrome/common/extensions/chrome_utility_extensions_messages.h"
41 #include "chrome/utility/extensions/extensions_handler.h" 45 #include "chrome/utility/extensions/extensions_handler.h"
42 #include "chrome/utility/image_writer/image_writer_handler.h" 46 #include "chrome/utility/image_writer/image_writer_handler.h"
43 #include "chrome/utility/media_galleries/ipc_data_source.h" 47 #include "chrome/utility/media_galleries/ipc_data_source.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection, 159 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
156 OnAnalyzeZipFileForDownloadProtection) 160 OnAnalyzeZipFileForDownloadProtection)
157 #endif 161 #endif
158 #if defined(ENABLE_EXTENSIONS) 162 #if defined(ENABLE_EXTENSIONS)
159 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata, 163 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseMediaMetadata,
160 OnParseMediaMetadata) 164 OnParseMediaMetadata)
161 #endif 165 #endif
162 #if defined(OS_CHROMEOS) 166 #if defined(OS_CHROMEOS)
163 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile) 167 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile)
164 #endif 168 #endif
169 #if defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
170 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DetectSeccompSupport,
171 OnDetectSeccompSupport)
172 #endif
165 IPC_MESSAGE_UNHANDLED(handled = false) 173 IPC_MESSAGE_UNHANDLED(handled = false)
166 IPC_END_MESSAGE_MAP() 174 IPC_END_MESSAGE_MAP()
167 175
168 for (Handlers::iterator it = handlers_.begin(); 176 for (Handlers::iterator it = handlers_.begin();
169 !handled && it != handlers_.end(); ++it) { 177 !handled && it != handlers_.end(); ++it) {
170 handled = (*it)->OnMessageReceived(message); 178 handled = (*it)->OnMessageReceived(message);
171 } 179 }
172 180
173 return handled; 181 return handled;
174 } 182 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 succeeded = zip::ZipFiles(src_dir, src_relative_paths, dest_fd.fd); 278 succeeded = zip::ZipFiles(src_dir, src_relative_paths, dest_fd.fd);
271 279
272 if (succeeded) 280 if (succeeded)
273 Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded()); 281 Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded());
274 else 282 else
275 Send(new ChromeUtilityHostMsg_CreateZipFile_Failed()); 283 Send(new ChromeUtilityHostMsg_CreateZipFile_Failed());
276 ReleaseProcessIfNeeded(); 284 ReleaseProcessIfNeeded();
277 } 285 }
278 #endif // defined(OS_CHROMEOS) 286 #endif // defined(OS_CHROMEOS)
279 287
288 #if defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
289 void ChromeContentUtilityClient::OnDetectSeccompSupport() {
290 bool supports_prctl = sandbox::SandboxBPF::SupportsSeccompSandbox(
291 sandbox::SandboxBPF::SeccompLevel::SINGLE_THREADED);
292 Send(new ChromeUtilityHostMsg_DetectSeccompSupport_ResultPrctl(
293 supports_prctl));
294
295 bool supports_syscall = sandbox::SandboxBPF::SupportsSeccompSandbox(
296 sandbox::SandboxBPF::SeccompLevel::MULTI_THREADED);
297 Send(new ChromeUtilityHostMsg_DetectSeccompSupport_ResultSyscall(
298 supports_syscall));
299
300 ReleaseProcessIfNeeded();
301 }
302 #endif // defined(OS_ANDROID) && defined(USE_SECCOMP_BPF)
303
280 void ChromeContentUtilityClient::OnRobustJPEGDecodeImage( 304 void ChromeContentUtilityClient::OnRobustJPEGDecodeImage(
281 const std::vector<unsigned char>& encoded_data) { 305 const std::vector<unsigned char>& encoded_data) {
282 // Our robust jpeg decoding is using IJG libjpeg. 306 // Our robust jpeg decoding is using IJG libjpeg.
283 if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG && 307 if (gfx::JPEGCodec::JpegLibraryVariant() == gfx::JPEGCodec::IJG_LIBJPEG &&
284 !encoded_data.empty()) { 308 !encoded_data.empty()) {
285 scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode( 309 scoped_ptr<SkBitmap> decoded_image(gfx::JPEGCodec::Decode(
286 &encoded_data[0], encoded_data.size())); 310 &encoded_data[0], encoded_data.size()));
287 if (!decoded_image.get() || decoded_image->empty()) { 311 if (!decoded_image.get() || decoded_image->empty()) {
288 Send(new ChromeUtilityHostMsg_DecodeImage_Failed()); 312 Send(new ChromeUtilityHostMsg_DecodeImage_Failed());
289 } else { 313 } else {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 const std::string& mime_type, int64 total_size, bool get_attached_images) { 389 const std::string& mime_type, int64 total_size, bool get_attached_images) {
366 // Only one IPCDataSource may be created and added to the list of handlers. 390 // Only one IPCDataSource may be created and added to the list of handlers.
367 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); 391 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size);
368 handlers_.push_back(source); 392 handlers_.push_back(source);
369 393
370 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( 394 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser(
371 source, mime_type, get_attached_images); 395 source, mime_type, get_attached_images);
372 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); 396 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser)));
373 } 397 }
374 #endif 398 #endif
OLDNEW
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698