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.
8 * @param {MetadataDispatcher} parent Parent object.
9 * @param {string} type Parser type.
10 * @param {RegExp} urlFilter RegExp to match URLs.
13 function MetadataParser(parent, type, urlFilter) {
14 this.parent_ = parent;
16 this.urlFilter = urlFilter;
17 this.verbose = parent.verbose;
18 this.mimeType = 'unknown';
22 * Output an error message.
23 * @param {...Object} var_args Arguments.
25 MetadataParser.prototype.error = function(var_args) {
26 this.parent_.error.apply(this.parent_, arguments);
30 * Output a log message.
31 * @param {...Object} var_args Arguments.
33 MetadataParser.prototype.log = function(var_args) {
34 this.parent_.log.apply(this.parent_, arguments);
38 * Output a log message if |verbose| flag is on.
39 * @param {...Object} var_args Arguments.
41 MetadataParser.prototype.vlog = function(var_args) {
43 this.parent_.log.apply(this.parent_, arguments);
47 * @return {Object} Metadata object with the minimal set of properties.
49 MetadataParser.prototype.createDefaultMetadata = function() {
52 mimeType: this.mimeType
56 /* Base class for image metadata parsers */
57 function ImageParser(parent, type, urlFilter) {
58 MetadataParser.apply(this, arguments);
59 this.mimeType = 'image/' + this.type;
62 ImageParser.prototype = {__proto__: MetadataParser.prototype};