summaryrefslogtreecommitdiffstats
path: root/chrome/browser/parsers/metadata_parser_manager.h
blob: 237553e489521cd0b31a41d5d00d6325fc07fbb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_PARSERS_METADATA_PARSER_MANAGER_H_
#define CHROME_BROWSER_PARSERS_METADATA_PARSER_MANAGER_H_

#include "base/basictypes.h"
#include "base/scoped_vector.h"

class MetadataParserFactory;
class FilePath;
class MetadataParser;

// Metadata Parser manager is used to find the correct parser for a
// given file.  Allows parsers to register themselves.
class MetadataParserManager {
 public:
  // Creates a new MetadataParserManager.
  MetadataParserManager();

  // Gets the singleton
  static MetadataParserManager* Get();

  // Adds a new Parser to the manager, when requests come in for a parser
  // the manager will loop through the list of parsers, and query each.
  bool RegisterParserFactory(MetadataParserFactory* parser);

  // Returns a new metadata parser for a given file.
  MetadataParser* GetParserForFile(const FilePath& path);

 private:
  ScopedVector<MetadataParserFactory> factories_;

  DISALLOW_COPY_AND_ASSIGN(MetadataParserManager);
};

#endif  // CHROME_BROWSER_PARSERS_METADATA_PARSER_MANAGER_H_