OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 function MetadataParser(parent) { | 5 function MetadataParser(parent, type, urlFilter) { |
6 this.parent_ = parent; | 6 this.parent_ = parent; |
| 7 this.type = type; |
| 8 this.urlFilter = urlFilter; |
7 this.verbose = parent.verbose; | 9 this.verbose = parent.verbose; |
8 } | 10 } |
9 | 11 |
10 MetadataParser.prototype.error = function(var_args) { | 12 MetadataParser.prototype.error = function(var_args) { |
11 this.parent_.error.apply(this.parent_, arguments); | 13 this.parent_.error.apply(this.parent_, arguments); |
12 }; | 14 }; |
13 | 15 |
14 MetadataParser.prototype.log = function(var_args) { | 16 MetadataParser.prototype.log = function(var_args) { |
15 this.parent_.log.apply(this.parent_, arguments); | 17 this.parent_.log.apply(this.parent_, arguments); |
16 }; | 18 }; |
17 | 19 |
18 MetadataParser.prototype.vlog = function(var_args) { | 20 MetadataParser.prototype.vlog = function(var_args) { |
19 if (this.verbose) | 21 if (this.verbose) |
20 this.parent_.log.apply(this.parent_, arguments); | 22 this.parent_.log.apply(this.parent_, arguments); |
21 }; | 23 }; |
| 24 |
| 25 MetadataParser.prototype.createDefaultMetadata = function() { return {} }; |
| 26 |
| 27 MetadataParser.prototype.acceptsMimeType = function(mimeType) { return false }; |
| 28 |
| 29 |
| 30 /* Base class for image metadata parsers */ |
| 31 function ImageParser(parent, type, urlFilter) { |
| 32 MetadataParser.apply(this, arguments); |
| 33 this.mimeType = 'image/' + this.type; |
| 34 } |
| 35 |
| 36 ImageParser.prototype = {__proto__: MetadataParser.prototype}; |
| 37 |
| 38 ImageParser.prototype.createDefaultMetadata = function() { |
| 39 return { mimeType: this.mimeType }; |
| 40 }; |
| 41 |
| 42 ImageParser.prototype.acceptsMimeType = function(mimeType) { |
| 43 return mimeType == this.mimeType; |
| 44 } |
| 45 |
OLD | NEW |