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