Chromium Code Reviews| Index: chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.cc |
| diff --git a/chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.cc b/chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.cc |
| index 7bf23e3c6c8b7d6a661c63c17722660015aedaac..1640b6771937a35984747b4e484ce6141c317321 100644 |
| --- a/chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.cc |
| +++ b/chrome/browser/media_galleries/fileapi/safe_media_metadata_parser.cc |
| @@ -14,14 +14,14 @@ using content::BrowserThread; |
| namespace metadata { |
| -SafeMediaMetadataParser::SafeMediaMetadataParser(Profile* profile, |
| - const std::string& blob_uuid, |
| - int64 blob_size, |
| - const std::string& mime_type) |
| +SafeMediaMetadataParser::SafeMediaMetadataParser( |
| + Profile* profile, const std::string& blob_uuid, int64 blob_size, |
| + const std::string& mime_type, bool get_attached_pictures) |
| : profile_(profile), |
| blob_uuid_(blob_uuid), |
| blob_size_(blob_size), |
| mime_type_(mime_type), |
| + get_attached_pictures_(get_attached_pictures), |
| parser_state_(INITIAL_STATE) { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| } |
| @@ -51,24 +51,32 @@ void SafeMediaMetadataParser::StartWorkOnIOThread( |
| this, base::MessageLoopProxy::current())->AsWeakPtr(); |
| utility_process_host_->Send( |
| - new ChromeUtilityMsg_ParseMediaMetadata(mime_type_, blob_size_)); |
| + new ChromeUtilityMsg_ParseMediaMetadata(mime_type_, blob_size_, |
| + get_attached_pictures_)); |
| parser_state_ = STARTED_PARSING_STATE; |
| } |
| void SafeMediaMetadataParser::OnParseMediaMetadataFinished( |
| - bool parse_success, const base::DictionaryValue& metadata_dictionary) { |
| + bool parse_success, const base::DictionaryValue& metadata_dictionary, |
| + const std::vector<std::string>& attached_pictures_bytes, |
| + const std::vector<std::string>& attached_pictures_types) { |
| DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| DCHECK(!callback_.is_null()); |
| if (parser_state_ != STARTED_PARSING_STATE) |
| return; |
| + if (attached_pictures_bytes.size() != attached_pictures_types.size()) { |
|
vandebo (ex-Chrome)
2014/04/23 23:22:45
nit: no {} Should this be a DCHECK ?
tommycli
2014/04/29 00:15:51
Done. Moving to a struct eliminated the need for t
|
| + DLOG(ERROR) << "Media metadata parser gave malformed attached picture data"; |
| + } |
| + |
| BrowserThread::PostTask( |
| BrowserThread::UI, |
| FROM_HERE, |
| base::Bind(callback_, parse_success, |
| - base::Owned(metadata_dictionary.DeepCopy()))); |
| + base::Owned(metadata_dictionary.DeepCopy()), |
| + attached_pictures_bytes, attached_pictures_types)); |
| parser_state_ = FINISHED_PARSING_STATE; |
| } |
| @@ -120,7 +128,8 @@ void SafeMediaMetadataParser::OnProcessCrashed(int exit_code) { |
| BrowserThread::PostTask( |
| BrowserThread::UI, |
| FROM_HERE, |
| - base::Bind(callback_, false, base::Owned(new base::DictionaryValue))); |
| + base::Bind(callback_, false, base::Owned(new base::DictionaryValue), |
| + std::vector<std::string>(), std::vector<std::string>())); |
| parser_state_ = FINISHED_PARSING_STATE; |
| } |