| 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 data_source import DataSource | 5 from data_source import DataSource |
| 6 from future import Future | 6 from future import Future |
| 7 from operator import itemgetter | 7 from operator import itemgetter |
| 8 | 8 |
| 9 from docs_server_utils import MarkLast, StringIdentity | 9 from docs_server_utils import MarkLast, StringIdentity |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 self._object_store = server_instance.object_store_creator.Create( | 29 self._object_store = server_instance.object_store_creator.Create( |
| 30 # Update the model when the API or Features model updates. | 30 # Update the model when the API or Features model updates. |
| 31 APIListDataSource, | 31 APIListDataSource, |
| 32 category=StringIdentity(self._features_bundle.GetIdentity(), | 32 category=StringIdentity(self._features_bundle.GetIdentity(), |
| 33 self._api_models.GetIdentity())) | 33 self._api_models.GetIdentity())) |
| 34 self._api_categorizer = server_instance.api_categorizer | 34 self._api_categorizer = server_instance.api_categorizer |
| 35 self._availability_finder = server_instance.availability_finder | 35 self._availability_finder = server_instance.availability_finder |
| 36 | 36 |
| 37 def _GenerateAPIDict(self): | 37 def _GenerateAPIDict(self): |
| 38 def get_channel_info(api_name): | 38 def get_channel_info(api_name): |
| 39 return self._availability_finder.GetApiAvailability(api_name).channel_info | 39 return self._availability_finder.GetAPIAvailability(api_name).channel_info |
| 40 | 40 |
| 41 def get_api_platform(api_name): | 41 def get_api_platform(api_name): |
| 42 feature = self._features_bundle.GetAPIFeatures().Get()[api_name] | 42 feature = self._features_bundle.GetAPIFeatures().Get()[api_name] |
| 43 return feature['platforms'] | 43 return feature['platforms'] |
| 44 | 44 |
| 45 def make_dict_for_platform(platform): | 45 def make_dict_for_platform(platform): |
| 46 platform_dict = { | 46 platform_dict = { |
| 47 'chrome': {'stable': [], 'beta': [], 'dev': [], 'trunk': []}, | 47 'chrome': {'stable': [], 'beta': [], 'dev': [], 'trunk': []}, |
| 48 } | 48 } |
| 49 private_apis = [] | 49 private_apis = [] |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 data = self._GenerateAPIDict() | 98 data = self._GenerateAPIDict() |
| 99 self._object_store.Set('api_data', data) | 99 self._object_store.Set('api_data', data) |
| 100 return data | 100 return data |
| 101 return Future(callback=resolve) | 101 return Future(callback=resolve) |
| 102 | 102 |
| 103 def get(self, key): | 103 def get(self, key): |
| 104 return self._GetCachedAPIData().Get().get(key) | 104 return self._GetCachedAPIData().Get().get(key) |
| 105 | 105 |
| 106 def Cron(self): | 106 def Cron(self): |
| 107 return self._GetCachedAPIData() | 107 return self._GetCachedAPIData() |
| OLD | NEW |