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

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

Issue 103283003: Media Galleries API Metadata: SafeMediaMetadataParser and IPCTunnelDataReader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/utility/media_galleries/ipc_data_source.cc ('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 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_ 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_
6 #define CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_ 6 #define CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/common/extensions/api/media_galleries.h" 10 #include "chrome/common/extensions/api/media_galleries.h"
11 11
12 namespace media { 12 namespace media {
13 class DataSource; 13 class DataSource;
14 } 14 }
15 15
16 namespace metadata { 16 namespace metadata {
17 17
18 // This class takes a MIME type and data source and parses its metadata. It 18 // This class takes a MIME type and data source and parses its metadata. It
19 // handles audio, video, and images. It delegates its operations to FFMPEG, 19 // handles audio, video, and images. It delegates its operations to FFMPEG,
20 // libexif, etc. This class lives and operates on the utility thread of the 20 // libexif, etc. This class lives and operates on the utility thread of the
21 // utility process, as we wish to sandbox potentially dangerous operations 21 // utility process, as we wish to sandbox potentially dangerous operations
22 // on user-provided data. 22 // on user-provided data.
23 class MediaMetadataParser { 23 class MediaMetadataParser {
24 public: 24 public:
25 typedef extensions::api::media_galleries::MediaMetadata MediaMetadata; 25 typedef extensions::api::media_galleries::MediaMetadata MediaMetadata;
26 typedef base::Callback<void(scoped_ptr<MediaMetadata>)> MetadataCallback; 26 typedef base::Callback<void(scoped_ptr<MediaMetadata>)> MetadataCallback;
27 27
28 // Does not take ownership of |source|. The MIME type is sniffed in the 28 // Does not take ownership of |source|. Caller is responsible for ensuring
29 // browser process, as it's faster (and safe enough). When the user wants 29 // that |source| outlives this object.
30 // more metadata than just the MIME type, this class provides it.
31 MediaMetadataParser(media::DataSource* source, const std::string& mime_type); 30 MediaMetadataParser(media::DataSource* source, const std::string& mime_type);
32 31
33 ~MediaMetadataParser(); 32 ~MediaMetadataParser();
34 33
35 // |callback| is called on same message loop. 34 // |callback| is called on same message loop.
36 void Start(const MetadataCallback& callback); 35 void Start(const MetadataCallback& callback);
37 36
38 private: 37 private:
39 void PopulateAudioVideoMetadata(); 38 void PopulateAudioVideoMetadata();
40 39
41 media::DataSource* source_; 40 media::DataSource* source_;
42 41
43 MetadataCallback callback_; 42 MetadataCallback callback_;
44 43
45 scoped_ptr<MediaMetadata> metadata_; 44 scoped_ptr<MediaMetadata> metadata_;
46 45
47 DISALLOW_COPY_AND_ASSIGN(MediaMetadataParser); 46 DISALLOW_COPY_AND_ASSIGN(MediaMetadataParser);
48 }; 47 };
49 48
50 } // namespace metadata 49 } // namespace metadata
51 50
52 #endif // CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_ 51 #endif // CHROME_UTILITY_MEDIA_GALLERIES_MEDIA_METADATA_PARSER_H_
OLDNEW
« no previous file with comments | « chrome/utility/media_galleries/ipc_data_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698