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

Side by Side Diff: chrome/utility/media_galleries/media_metadata_parser.cc

Issue 1825913002: [Extensions] Convert APIs to use movable types [7] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Steven's Created 4 years, 8 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/common/extensions/api/notifications.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/media_galleries/media_metadata_parser.h" 5 #include "chrome/utility/media_galleries/media_metadata_parser.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
13 #include "base/task_runner_util.h" 12 #include "base/task_runner_util.h"
14 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
15 #include "media/base/audio_video_metadata_extractor.h" 14 #include "media/base/audio_video_metadata_extractor.h"
16 #include "media/base/data_source.h" 15 #include "media/base/data_source.h"
17 #include "net/base/mime_sniffer.h" 16 #include "net/base/mime_sniffer.h"
18 17
19 namespace MediaGalleries = extensions::api::media_galleries; 18 namespace MediaGalleries = extensions::api::media_galleries;
20 19
21 namespace metadata { 20 namespace metadata {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 SetIntScopedPtr(extractor.disc(), &metadata->disc); 66 SetIntScopedPtr(extractor.disc(), &metadata->disc);
68 SetStringScopedPtr(extractor.genre(), &metadata->genre); 67 SetStringScopedPtr(extractor.genre(), &metadata->genre);
69 SetStringScopedPtr(extractor.language(), &metadata->language); 68 SetStringScopedPtr(extractor.language(), &metadata->language);
70 SetIntScopedPtr(extractor.rotation(), &metadata->rotation); 69 SetIntScopedPtr(extractor.rotation(), &metadata->rotation);
71 SetStringScopedPtr(extractor.title(), &metadata->title); 70 SetStringScopedPtr(extractor.title(), &metadata->title);
72 SetIntScopedPtr(extractor.track(), &metadata->track); 71 SetIntScopedPtr(extractor.track(), &metadata->track);
73 72
74 for (media::AudioVideoMetadataExtractor::StreamInfoVector::const_iterator it = 73 for (media::AudioVideoMetadataExtractor::StreamInfoVector::const_iterator it =
75 extractor.stream_infos().begin(); 74 extractor.stream_infos().begin();
76 it != extractor.stream_infos().end(); ++it) { 75 it != extractor.stream_infos().end(); ++it) {
77 linked_ptr<MediaGalleries::StreamInfo> stream_info( 76 MediaGalleries::StreamInfo stream_info;
78 new MediaGalleries::StreamInfo); 77 stream_info.type = it->type;
79 stream_info->type = it->type;
80 78
81 for (std::map<std::string, std::string>::const_iterator tag_it = 79 for (std::map<std::string, std::string>::const_iterator tag_it =
82 it->tags.begin(); 80 it->tags.begin();
83 tag_it != it->tags.end(); ++tag_it) { 81 tag_it != it->tags.end(); ++tag_it) {
84 stream_info->tags.additional_properties.SetString(tag_it->first, 82 stream_info.tags.additional_properties.SetString(tag_it->first,
85 tag_it->second); 83 tag_it->second);
86 } 84 }
87 85
88 metadata->raw_tags.push_back(stream_info); 86 metadata->raw_tags.push_back(std::move(stream_info));
89 } 87 }
90 88
91 if (get_attached_images) { 89 if (get_attached_images) {
92 for (std::vector<std::string>::const_iterator it = 90 for (std::vector<std::string>::const_iterator it =
93 extractor.attached_images_bytes().begin(); 91 extractor.attached_images_bytes().begin();
94 it != extractor.attached_images_bytes().end(); ++it) { 92 it != extractor.attached_images_bytes().end(); ++it) {
95 attached_images->push_back(AttachedImage()); 93 attached_images->push_back(AttachedImage());
96 attached_images->back().data = *it; 94 attached_images->back().data = *it;
97 net::SniffMimeTypeFromLocalData(it->c_str(), it->length(), 95 net::SniffMimeTypeFromLocalData(it->c_str(), it->length(),
98 &attached_images->back().type); 96 &attached_images->back().type);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 get_attached_images_, metadata, attached_images), 137 get_attached_images_, metadata, attached_images),
140 base::Bind(&FinishParseAudioVideoMetadata, callback, 138 base::Bind(&FinishParseAudioVideoMetadata, callback,
141 base::Owned(metadata), base::Owned(attached_images))); 139 base::Owned(metadata), base::Owned(attached_images)));
142 return; 140 return;
143 } 141 }
144 142
145 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); 143 callback.Run(MediaMetadata(), std::vector<AttachedImage>());
146 } 144 }
147 145
148 } // namespace metadata 146 } // namespace metadata
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/notifications.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698