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

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

Issue 68873003: Docserver: Serve docs out of src/ not src/chrome/common/extensions. This allows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 1 month 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 | Annotate | Revision Log
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 from extensions_paths import (
6 API_FEATURES, JSON_TEMPLATES, MANIFEST_FEATURES, PERMISSION_FEATURES)
5 import features_utility 7 import features_utility
6 from future import Gettable, Future 8 from future import Gettable, Future
7 import svn_constants
8 from third_party.json_schema_compiler.json_parse import Parse 9 from third_party.json_schema_compiler.json_parse import Parse
9 10
10 11
11 def _AddPlatformsFromDependencies(feature, 12 def _AddPlatformsFromDependencies(feature,
12 api_features, 13 api_features,
13 manifest_features, 14 manifest_features,
14 permission_features): 15 permission_features):
15 features_map = { 16 features_map = {
16 'api': api_features, 17 'api': api_features,
17 'manifest': manifest_features, 18 'manifest': manifest_features,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return self._cache.GetFromFile(self._json_path) 58 return self._cache.GetFromFile(self._json_path)
58 59
59 60
60 class FeaturesBundle(object): 61 class FeaturesBundle(object):
61 '''Provides access to properties of API, Manifest, and Permission features. 62 '''Provides access to properties of API, Manifest, and Permission features.
62 ''' 63 '''
63 def __init__(self, file_system, compiled_fs_factory, object_store_creator): 64 def __init__(self, file_system, compiled_fs_factory, object_store_creator):
64 self._api_cache = _FeaturesCache( 65 self._api_cache = _FeaturesCache(
65 file_system, 66 file_system,
66 compiled_fs_factory, 67 compiled_fs_factory,
67 svn_constants.API_FEATURES_PATH) 68 API_FEATURES)
68 self._manifest_cache = _FeaturesCache( 69 self._manifest_cache = _FeaturesCache(
69 file_system, 70 file_system,
70 compiled_fs_factory, 71 compiled_fs_factory,
71 svn_constants.MANIFEST_FEATURES_PATH, 72 MANIFEST_FEATURES,
72 svn_constants.MANIFEST_JSON_PATH) 73 '%s/manifest.json' % JSON_TEMPLATES)
73 self._permission_cache = _FeaturesCache( 74 self._permission_cache = _FeaturesCache(
74 file_system, 75 file_system,
75 compiled_fs_factory, 76 compiled_fs_factory,
76 svn_constants.PERMISSION_FEATURES_PATH, 77 PERMISSION_FEATURES,
77 svn_constants.PERMISSIONS_JSON_PATH) 78 '%s/permissions.json' % JSON_TEMPLATES)
78 self._object_store = object_store_creator.Create(_FeaturesCache, 'features') 79 self._object_store = object_store_creator.Create(_FeaturesCache, 'features')
79 80
80 def GetPermissionFeatures(self): 81 def GetPermissionFeatures(self):
81 return self._permission_cache.GetFeatures() 82 return self._permission_cache.GetFeatures()
82 83
83 def GetManifestFeatures(self): 84 def GetManifestFeatures(self):
84 return self._manifest_cache.GetFeatures() 85 return self._manifest_cache.GetFeatures()
85 86
86 def GetAPIFeatures(self): 87 def GetAPIFeatures(self):
87 api_features = self._object_store.Get('api_features').Get() 88 api_features = self._object_store.Get('api_features').Get()
(...skipping 10 matching lines...) Expand all
98 # TODO(rockot): Handle inter-API dependencies more gracefully. 99 # TODO(rockot): Handle inter-API dependencies more gracefully.
99 # Not yet a problem because there is only one such case (windows -> tabs). 100 # Not yet a problem because there is only one such case (windows -> tabs).
100 # If we don't store this value before annotating platforms, inter-API 101 # If we don't store this value before annotating platforms, inter-API
101 # dependencies will lead to infinite recursion. 102 # dependencies will lead to infinite recursion.
102 for feature in api_features.itervalues(): 103 for feature in api_features.itervalues():
103 _AddPlatformsFromDependencies( 104 _AddPlatformsFromDependencies(
104 feature, api_features, manifest_features, permission_features) 105 feature, api_features, manifest_features, permission_features)
105 self._object_store.Set('api_features', api_features) 106 self._object_store.Set('api_features', api_features)
106 return api_features 107 return api_features
107 return Future(delegate=Gettable(resolve)) 108 return Future(delegate=Gettable(resolve))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698