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