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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_PARSERS_METADATA_PARSER_MANAGER_H_ 6#define CHROME_BROWSER_PARSERS_METADATA_PARSER_MANAGER_H_ 7#pragma once 8 9#include "base/basictypes.h" 10#include "base/memory/scoped_vector.h" 11 12class MetadataParserFactory; 13class FilePath; 14class MetadataParser; 15 16// Metadata Parser manager is used to find the correct parser for a 17// given file. Allows parsers to register themselves. 18class MetadataParserManager { 19 public: 20 // Creates a new MetadataParserManager. 21 MetadataParserManager(); 22 ~MetadataParserManager(); 23 24 // Gets the singleton 25 static MetadataParserManager* GetInstance(); 26 27 // Adds a new Parser to the manager, when requests come in for a parser 28 // the manager will loop through the list of parsers, and query each. 29 bool RegisterParserFactory(MetadataParserFactory* parser); 30 31 // Returns a new metadata parser for a given file. 32 MetadataParser* GetParserForFile(const FilePath& path); 33 34 private: 35 ScopedVector<MetadataParserFactory> factories_; 36 37 DISALLOW_COPY_AND_ASSIGN(MetadataParserManager); 38}; 39 40#endif // CHROME_BROWSER_PARSERS_METADATA_PARSER_MANAGER_H_ 41