OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 function MetadataParser(parent, type, urlFilter) { | |
6 this.parent_ = parent; | |
7 this.type = type; | |
8 this.urlFilter = urlFilter; | |
9 this.verbose = parent.verbose; | |
10 this.mimeType = 'unknown'; | |
11 } | |
12 | |
13 MetadataParser.prototype.error = function(var_args) { | |
14 this.parent_.error.apply(this.parent_, arguments); | |
15 }; | |
16 | |
17 MetadataParser.prototype.log = function(var_args) { | |
18 this.parent_.log.apply(this.parent_, arguments); | |
19 }; | |
20 | |
21 MetadataParser.prototype.vlog = function(var_args) { | |
22 if (this.verbose) | |
23 this.parent_.log.apply(this.parent_, arguments); | |
24 }; | |
25 | |
26 MetadataParser.prototype.createDefaultMetadata = function() { | |
27 return { | |
28 type: this.type, | |
29 mimeType: this.mimeType | |
30 }; | |
31 }; | |
32 | |
33 MetadataParser.prototype.acceptsMimeType = function(mimeType) { | |
34 return mimeType == this.mimeType; | |
35 }; | |
36 | |
37 /* Base class for image metadata parsers */ | |
38 function ImageParser(parent, type, urlFilter) { | |
39 MetadataParser.apply(this, arguments); | |
40 this.mimeType = 'image/' + this.type; | |
41 } | |
42 | |
43 ImageParser.prototype = {__proto__: MetadataParser.prototype}; | |
OLD | NEW |