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 #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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 void ChromeContentUtilityClient::OnDecodeImage( | 242 void ChromeContentUtilityClient::OnDecodeImage( |
243 const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) { | 243 const std::vector<unsigned char>& encoded_data, bool shrink_to_fit) { |
244 DecodeImageAndSend(encoded_data, shrink_to_fit); | 244 DecodeImageAndSend(encoded_data, shrink_to_fit); |
245 } | 245 } |
246 | 246 |
247 #if defined(OS_CHROMEOS) | 247 #if defined(OS_CHROMEOS) |
248 void ChromeContentUtilityClient::OnCreateZipFile( | 248 void ChromeContentUtilityClient::OnCreateZipFile( |
249 const base::FilePath& src_dir, | 249 const base::FilePath& src_dir, |
250 const std::vector<base::FilePath>& src_relative_paths, | 250 const std::vector<base::FilePath>& src_relative_paths, |
251 const base::FileDescriptor& dest_fd) { | 251 const base::FileDescriptor& dest_fd) { |
252 base::ScopedFD scoped_fd(dest_fd.fd); | |
satorux1
2014/11/14 02:27:51
Maybe name it fd_closer to make it even clearer?
jeremyspiegel
2014/11/14 23:49:26
Sure, sounds good.
| |
252 bool succeeded = true; | 253 bool succeeded = true; |
253 | 254 |
254 // Check sanity of source relative paths. Reject if path is absolute or | 255 // Check sanity of source relative paths. Reject if path is absolute or |
255 // contains any attempt to reference a parent directory ("../" tricks). | 256 // contains any attempt to reference a parent directory ("../" tricks). |
256 for (std::vector<base::FilePath>::const_iterator iter = | 257 for (std::vector<base::FilePath>::const_iterator iter = |
257 src_relative_paths.begin(); iter != src_relative_paths.end(); | 258 src_relative_paths.begin(); iter != src_relative_paths.end(); |
258 ++iter) { | 259 ++iter) { |
259 if (iter->IsAbsolute() || iter->ReferencesParent()) { | 260 if (iter->IsAbsolute() || iter->ReferencesParent()) { |
260 succeeded = false; | 261 succeeded = false; |
261 break; | 262 break; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 const std::string& mime_type, int64 total_size, bool get_attached_images) { | 347 const std::string& mime_type, int64 total_size, bool get_attached_images) { |
347 // Only one IPCDataSource may be created and added to the list of handlers. | 348 // Only one IPCDataSource may be created and added to the list of handlers. |
348 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); | 349 metadata::IPCDataSource* source = new metadata::IPCDataSource(total_size); |
349 handlers_.push_back(source); | 350 handlers_.push_back(source); |
350 | 351 |
351 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( | 352 metadata::MediaMetadataParser* parser = new metadata::MediaMetadataParser( |
352 source, mime_type, get_attached_images); | 353 source, mime_type, get_attached_images); |
353 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); | 354 parser->Start(base::Bind(&FinishParseMediaMetadata, base::Owned(parser))); |
354 } | 355 } |
355 #endif | 356 #endif |
OLD | NEW |