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

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

Issue 14273041: Doc server manifest page generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manifest Update preview 2 Created 7 years, 7 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
(Empty)
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from copy import deepcopy
6 import json
7 import os
8
9 from svn_constants import JSON_PATH
not at google - send to devlin 2013/05/03 15:56:25 this is the kind of thing to pass into the constru
jshumway 2013/05/10 02:08:36 Done.
10
11 def apply_apps_transformations(manifest):
not at google - send to devlin 2013/05/03 15:56:25 should be _ApplyAppsTransformations
jshumway 2013/05/10 02:08:36 Done.
12 manifest['required'][0]['example'] = 'My Application'
13
14 def apply_extensions_transformations(manifest):
15 pass
not at google - send to devlin 2013/05/03 15:56:25 almost there - but this needs to filter the manife
jshumway 2013/05/10 02:08:36 This was one of the major of my patch. Now the man
16
17 class ManifestDataSource(object):
18 """ Provides a template with access to manifest properties specific to apps or
19 extensions.
20 """
21 def __init__(self, compiled_fs_factory, store_type):
22 self._compiled_fs = compiled_fs_factory.Create(
23 lambda _, contents: json.loads(contents), store_type)
not at google - send to devlin 2013/05/03 15:56:25 the store_type variable is so that each class can
jshumway 2013/05/10 02:08:36 Done.
24
25 self.loaded = False
26
27 def get(self, key):
28 if not self.loaded:
not at google - send to devlin 2013/05/03 15:56:25 CompiledFileSystem implements this loading logic i
jshumway 2013/05/10 02:08:36 Done.
29 manifest_json = self._compiled_fs.GetFromFile(
30 os.path.join(JSON_PATH, 'manifest.json'))
31 self.extensions = deepcopy(manifest_json)
32 self.apps = deepcopy(manifest_json)
33
34 apply_apps_transformations(self.apps)
35 apply_extensions_transformations(self.extensions)
36 self.loaded = True
37
38 if key == 'apps':
39 return self.apps
40 elif key == 'extensions':
41 return self.extensions
42 else:
43 raise KeyError
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698