1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_PARSERS_METADATA_PARSER_FACTORY_H_ 6 #define CHROME_BROWSER_PARSERS_METADATA_PARSER_FACTORY_H_ 7 #pragma once 8 9 #include "chrome/browser/parsers/metadata_parser.h" 10 11 class FilePath; 12 13 // Used to check to see if a parser can parse a particular file, and allows 14 // for creation of a parser on a particular file. 15 class MetadataParserFactory { 16 public: 17 MetadataParserFactory() {} 18 virtual ~MetadataParserFactory() {} 19 20 // Used to check to see if the parser can parse the given file. This 21 // should not do any additional reading of the file. 22 virtual bool CanParse(const FilePath& path, 23 char* bytes, 24 int bytes_size) = 0; 25 26 // Creates the parser on the given file. Creating the parser does not 27 // do any parsing on the file. Parse has to be called on the parser. 28 virtual MetadataParser* CreateParser(const FilePath& path) = 0; 29 }; 30 31 #endif // CHROME_BROWSER_PARSERS_METADATA_PARSER_FACTORY_H_ 32