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 from operator import itemgetter | 5 from operator import itemgetter |
6 import os | 6 import os |
7 | 7 |
8 from third_party.json_schema_compiler.json_parse import Parse | 8 from third_party.json_schema_compiler.json_parse import Parse |
9 import third_party.json_schema_compiler.model as model | 9 import third_party.json_schema_compiler.model as model |
10 import docs_server_utils as utils | 10 import docs_server_utils as utils |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 'extensions': MakeDictForPlatform('extensions') | 91 'extensions': MakeDictForPlatform('extensions') |
92 } | 92 } |
93 | 93 |
94 def Create(self): | 94 def Create(self): |
95 return APIListDataSource(self, self._object_store_creator) | 95 return APIListDataSource(self, self._object_store_creator) |
96 | 96 |
97 def __init__(self, factory, object_store_creator): | 97 def __init__(self, factory, object_store_creator): |
98 self._factory = factory | 98 self._factory = factory |
99 self._object_store = object_store_creator.Create(APIListDataSource) | 99 self._object_store = object_store_creator.Create(APIListDataSource) |
100 | 100 |
101 def GetAllNames(self): | |
102 apis = [] | |
103 for platform in ['apps', 'extensions']: | |
104 for category in ['chrome', 'experimental', 'private']: | |
105 apis.extend(self.get(platform).get(category)) | |
106 return [api['name'] for api in apis] | |
107 | |
108 def _GetCachedAPIData(self): | 101 def _GetCachedAPIData(self): |
109 data = self._object_store.Get('api_data').Get() | 102 data = self._object_store.Get('api_data').Get() |
110 if data is None: | 103 if data is None: |
111 data = self._factory._GenerateAPIDict() | 104 data = self._factory._GenerateAPIDict() |
112 self._object_store.Set('api_data', data) | 105 self._object_store.Set('api_data', data) |
113 return data | 106 return data |
114 | 107 |
115 def get(self, key): | 108 def get(self, key): |
116 return self._GetCachedAPIData().get(key) | 109 return self._GetCachedAPIData().get(key) |
OLD | NEW |