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

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

Issue 1167163002: chrome: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing message_loop.h includes. Created 5 years, 6 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
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/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
11 #include "base/message_loop/message_loop.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/task_runner_util.h" 13 #include "base/task_runner_util.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "chrome/utility/media_galleries/image_metadata_extractor.h" 15 #include "chrome/utility/media_galleries/image_metadata_extractor.h"
16 #include "media/base/audio_video_metadata_extractor.h" 16 #include "media/base/audio_video_metadata_extractor.h"
17 #include "media/base/data_source.h" 17 #include "media/base/data_source.h"
18 #include "net/base/mime_sniffer.h" 18 #include "net/base/mime_sniffer.h"
19 19
20 namespace MediaGalleries = extensions::api::media_galleries; 20 namespace MediaGalleries = extensions::api::media_galleries;
21 21
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 void MediaMetadataParser::Start(const MetadataCallback& callback) { 168 void MediaMetadataParser::Start(const MetadataCallback& callback) {
169 if (StartsWithASCII(mime_type_, "audio/", true) || 169 if (StartsWithASCII(mime_type_, "audio/", true) ||
170 StartsWithASCII(mime_type_, "video/", true)) { 170 StartsWithASCII(mime_type_, "video/", true)) {
171 MediaMetadata* metadata = new MediaMetadata; 171 MediaMetadata* metadata = new MediaMetadata;
172 metadata->mime_type = mime_type_; 172 metadata->mime_type = mime_type_;
173 std::vector<AttachedImage>* attached_images = 173 std::vector<AttachedImage>* attached_images =
174 new std::vector<AttachedImage>; 174 new std::vector<AttachedImage>;
175 175
176 media_thread_.reset(new base::Thread("media_thread")); 176 media_thread_.reset(new base::Thread("media_thread"));
177 CHECK(media_thread_->Start()); 177 CHECK(media_thread_->Start());
178 media_thread_->message_loop_proxy()->PostTaskAndReply( 178 media_thread_->task_runner()->PostTaskAndReply(
179 FROM_HERE, 179 FROM_HERE, base::Bind(&ParseAudioVideoMetadata, source_,
180 base::Bind(&ParseAudioVideoMetadata, source_, get_attached_images_, 180 get_attached_images_, metadata, attached_images),
181 metadata, attached_images),
182 base::Bind(&FinishParseAudioVideoMetadata, callback, 181 base::Bind(&FinishParseAudioVideoMetadata, callback,
183 base::Owned(metadata), base::Owned(attached_images))); 182 base::Owned(metadata), base::Owned(attached_images)));
184 return; 183 return;
185 } 184 }
186 185
187 if (StartsWithASCII(mime_type_, "image/", true)) { 186 if (StartsWithASCII(mime_type_, "image/", true)) {
188 ImageMetadataExtractor* extractor = new ImageMetadataExtractor; 187 ImageMetadataExtractor* extractor = new ImageMetadataExtractor;
189 extractor->Extract( 188 extractor->Extract(
190 source_, 189 source_,
191 base::Bind(&FinishParseImageMetadata, base::Owned(extractor), 190 base::Bind(&FinishParseImageMetadata, base::Owned(extractor),
192 mime_type_, callback)); 191 mime_type_, callback));
193 return; 192 return;
194 } 193 }
195 194
196 callback.Run(MediaMetadata(), std::vector<AttachedImage>()); 195 callback.Run(MediaMetadata(), std::vector<AttachedImage>());
197 } 196 }
198 197
199 } // namespace metadata 198 } // namespace metadata
OLDNEW
« no previous file with comments | « chrome/utility/local_discovery/service_discovery_message_handler.cc ('k') | chrome/utility/profile_import_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698