| Index: chrome/common/extensions/docs/server2/api_data_source.py
|
| diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
|
| index 90858cd50740f8e64f94a11c25ffaa8548953f5f..56b2dc2c71cbb8870657577e8038d50b0dada6f7 100644
|
| --- a/chrome/common/extensions/docs/server2/api_data_source.py
|
| +++ b/chrome/common/extensions/docs/server2/api_data_source.py
|
| @@ -16,19 +16,31 @@ class APIDataSource(object):
|
| """This class fetches and loads JSON APIs from the FileSystem passed in with
|
| |cache_builder|, so the APIs can be plugged into templates.
|
| """
|
| - def __init__(self, cache_builder, base_path):
|
| +
|
| + class Factory(object):
|
| + def __init__(self, cache_builder, base_path):
|
| + self._cache_builder = cache_builder
|
| + self._base_path = base_path
|
| +
|
| + def Create(self, samples):
|
| + return APIDataSource(self._cache_builder, self._base_path, samples)
|
| +
|
| + def __init__(self, cache_builder, base_path, samples):
|
| + self._samples = samples
|
| self._json_cache = cache_builder.build(self._LoadJsonAPI)
|
| self._idl_cache = cache_builder.build(self._LoadIdlAPI)
|
| self._base_path = base_path
|
|
|
| def _LoadJsonAPI(self, api):
|
| generator = HandlebarDictGenerator(
|
| - json.loads(json_comment_eater.Nom(api))[0])
|
| + json.loads(json_comment_eater.Nom(api))[0],
|
| + self._samples)
|
| return generator.Generate()
|
|
|
| def _LoadIdlAPI(self, api):
|
| idl = idl_parser.IDLParser().ParseData(api)
|
| - generator = HandlebarDictGenerator(idl_schema.IDLSchema(idl).process()[0])
|
| + generator = HandlebarDictGenerator(idl_schema.IDLSchema(idl).process()[0],
|
| + self._samples)
|
| return generator.Generate()
|
|
|
| def __getitem__(self, key):
|
|
|