OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 // Media parsing interface provided by the utility process and exposed by | 5 // Media parsing interface provided by the utility process and exposed by |
6 // mojo policy control to the chrome browser process. | 6 // mojo policy control to the chrome browser process. |
7 | 7 |
8 module extensions.mojom; | 8 module extensions.mojom; |
9 | 9 |
10 import "mojo/common/file.mojom"; | 10 import "mojo/common/file.mojom"; |
11 import "mojo/common/time.mojom"; | 11 import "mojo/common/time.mojom"; |
12 import "mojo/common/values.mojom"; | 12 import "mojo/common/values.mojom"; |
13 | 13 |
14 struct AttachedImage { | |
15 string type; | |
16 array<uint8> data; | |
17 }; | |
18 | |
19 interface MediaParser { | 14 interface MediaParser { |
15 // Extract metadata from a |mime_type| blob of data of |total_size| and | |
16 // available from the browser process via |media_data_source|. If there | |
17 // are images referred to in the metadata, and |get_attached_images| is | |
18 // true, return the images in |attached_images|. | |
20 ParseMediaMetadata(string mime_type, | 19 ParseMediaMetadata(string mime_type, |
21 int64 total_size, | 20 int64 total_size, |
22 bool get_attached_images) | 21 bool get_attached_images, |
22 MediaDataSource media_data_source) | |
23 => (bool parse_success, | 23 => (bool parse_success, |
24 mojo.common.mojom.DictionaryValue metadata, | 24 mojo.common.mojom.DictionaryValue metadata, |
25 array<AttachedImage> attached_images); | 25 array<AttachedImage> attached_images); |
26 | 26 |
27 // Validate the passed media file with sanity checks, and file decoding | 27 // Validate the passed media file with sanity checks, and file decoding |
28 // for at most |decode_time| wall clock time. Returns |success| true if | 28 // for at most |decode_time| wall clock time. Returns |success| true if |
29 // |file| appears to be a well-formed media file, false otherwise. | 29 // |file| appears to be a well-formed media file, false otherwise. |
30 // Note: it is still not safe to decode the file in the browser process | 30 // Note: it is still not safe to decode the file in the browser process |
31 // after this check. | 31 // after this check. |
32 CheckMediaFile(mojo.common.mojom.TimeDelta decode_time, | 32 CheckMediaFile(mojo.common.mojom.TimeDelta decode_time, |
33 mojo.common.mojom.File file) | 33 mojo.common.mojom.File file) |
34 => (bool success); | 34 => (bool success); |
35 }; | 35 }; |
36 | |
37 interface MediaDataSource { | |
38 // ParseMediaMetadata interface used to read blob data for parsing from | |
39 // the browser process. | |
40 ReadBlob(int64 request_id, int64 position, int64 length) | |
Sam McNally
2017/02/03 22:14:16
Remove |request_id|.
Noel Gordon
2017/02/05 23:45:03
Indeed, done.
| |
41 => (int64 request_id, array<uint8> data); | |
42 }; | |
43 | |
44 struct AttachedImage { | |
45 // If ParseMediaMetadata returns attached images, each of the images is | |
46 // returned in an AttachedImage object. | |
47 string type; | |
48 array<uint8> data; | |
49 }; | |
OLD | NEW |