OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_EXTENSIONS_EXTENSION_FUNCTION_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_REGISTRY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_REGISTRY_H_ |
7 #pragma once | |
8 | 7 |
9 #include <map> | 8 #include <map> |
10 #include <string> | 9 #include <string> |
11 #include <vector> | 10 #include <vector> |
12 | 11 |
13 class ExtensionFunction; | 12 class ExtensionFunction; |
14 | 13 |
15 // A factory function for creating new ExtensionFunction instances. | 14 // A factory function for creating new ExtensionFunction instances. |
16 typedef ExtensionFunction* (*ExtensionFunctionFactory)(); | 15 typedef ExtensionFunction* (*ExtensionFunctionFactory)(); |
17 | 16 |
(...skipping 29 matching lines...) Expand all Loading... |
47 void RegisterFunction() { | 46 void RegisterFunction() { |
48 factories_[T::function_name()] = &NewExtensionFunction<T>; | 47 factories_[T::function_name()] = &NewExtensionFunction<T>; |
49 } | 48 } |
50 | 49 |
51 private: | 50 private: |
52 typedef std::map<std::string, ExtensionFunctionFactory> FactoryMap; | 51 typedef std::map<std::string, ExtensionFunctionFactory> FactoryMap; |
53 FactoryMap factories_; | 52 FactoryMap factories_; |
54 }; | 53 }; |
55 | 54 |
56 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_REGISTRY_H_ | 55 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_REGISTRY_H_ |
OLD | NEW |