Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/common/extensions/docs/server2/manifest_data_source.py

Issue 22824042: Docserver: SidenavDataSource refactor, transition to DataSourceRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup, deleted unused files/import Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import json 5 import json
6 6
7 from data_source import DataSource 7 from data_source import DataSource
8 import features_utility 8 import features_utility
9 from manifest_features import CreateManifestFeatures, ConvertDottedKeysToNested 9 from manifest_features import CreateManifestFeatures, ConvertDottedKeysToNested
10 from third_party.json_schema_compiler.json_parse import Parse 10 from third_party.json_schema_compiler.json_parse import Parse
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 annotate(level, item['children']) 92 annotate(level, item['children'])
93 if features: 93 if features:
94 features[-1]['is_last'] = True 94 features[-1]['is_last'] = True
95 95
96 annotate('required', features) 96 annotate('required', features)
97 return features 97 return features
98 98
99 class ManifestDataSource(DataSource): 99 class ManifestDataSource(DataSource):
100 '''Provides access to the properties in manifest features. 100 '''Provides access to the properties in manifest features.
101 ''' 101 '''
102 def __init__(self, server_instance): 102 def __init__(self, server_instance, _):
103 self._manifest_path = server_instance.manifest_json_path 103 self._manifest_path = server_instance.manifest_json_path
104 self._features_path = server_instance.manifest_features_path 104 self._features_path = server_instance.manifest_features_path
105 self._file_system = server_instance.host_file_system 105 self._file_system = server_instance.host_file_system
106 self._cache = server_instance.compiled_host_fs_factory.Create( 106 self._cache = server_instance.compiled_host_fs_factory.Create(
107 self._CreateManifestData, ManifestDataSource) 107 self._CreateManifestData, ManifestDataSource)
108 108
109 def _CreateManifestData(self, _, content): 109 def _CreateManifestData(self, _, content):
110 '''Combine the contents of |_manifest_path| and |_features_path| and filter 110 '''Combine the contents of |_manifest_path| and |_features_path| and filter
111 the results into lists specific to apps or extensions for templates. Marks 111 the results into lists specific to apps or extensions for templates. Marks
112 up features with annotations. 112 up features with annotations.
(...skipping 13 matching lines...) Expand all
126 'apps': for_templates(manifest_features, 'app'), 126 'apps': for_templates(manifest_features, 'app'),
127 'extensions': for_templates(manifest_features, 'extension') 127 'extensions': for_templates(manifest_features, 'extension')
128 } 128 }
129 129
130 def Cron(self): 130 def Cron(self):
131 self._cache.GetFromFile(self._features_path) 131 self._cache.GetFromFile(self._features_path)
132 self._file_system.ReadSingle(self._manifest_path) 132 self._file_system.ReadSingle(self._manifest_path)
133 133
134 def get(self, key): 134 def get(self, key):
135 return self._cache.GetFromFile(self._features_path)[key] 135 return self._cache.GetFromFile(self._features_path)[key]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698