OLD | NEW |
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 itertools import groupby | 5 from itertools import groupby |
6 from operator import itemgetter | 6 from operator import itemgetter |
7 import posixpath | 7 import posixpath |
8 | 8 |
9 from data_source import DataSource | 9 from data_source import DataSource |
10 from extensions_paths import JSON_TEMPLATES, PUBLIC_TEMPLATES | 10 from extensions_paths import JSON_TEMPLATES, PUBLIC_TEMPLATES |
11 from future import Future | 11 from future import Future |
12 from platform_util import GetPlatforms | 12 from platform_util import GetPlatforms |
13 | 13 |
14 | 14 |
15 class WhatsNewDataSource(DataSource): | 15 class WhatsNewDataSource(DataSource): |
16 ''' This class creates a list of "what is new" by chrome version. | 16 ''' This class creates a list of "what is new" by chrome version. |
17 ''' | 17 ''' |
18 | 18 |
19 def __init__(self, server_instance, _): | 19 def __init__(self, server_instance, _): |
20 self._parse_cache = server_instance.compiled_fs_factory.ForJson( | 20 self._parse_cache = server_instance.compiled_fs_factory.ForJson( |
21 server_instance.host_file_system_provider.GetTrunk()) | 21 server_instance.host_file_system_provider.GetMaster()) |
22 self._object_store = server_instance.object_store_creator.Create( | 22 self._object_store = server_instance.object_store_creator.Create( |
23 WhatsNewDataSource) | 23 WhatsNewDataSource) |
24 self._platform_bundle = server_instance.platform_bundle | 24 self._platform_bundle = server_instance.platform_bundle |
25 | 25 |
26 def _GenerateChangesListWithVersion(self, platform, whats_new_json): | 26 def _GenerateChangesListWithVersion(self, platform, whats_new_json): |
27 return [{ | 27 return [{ |
28 'id': change_id, | 28 'id': change_id, |
29 'type': change['type'], | 29 'type': change['type'], |
30 'description': change['description'], | 30 'description': change['description'], |
31 'version': change['version'] | 31 'version': change['version'] |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 if data is None: | 91 if data is None: |
92 data = self._GenerateWhatsNewDict().Get() | 92 data = self._GenerateWhatsNewDict().Get() |
93 self._object_store.Set('whats_new_data', data) | 93 self._object_store.Set('whats_new_data', data) |
94 return data | 94 return data |
95 | 95 |
96 def get(self, key): | 96 def get(self, key): |
97 return self._GetCachedWhatsNewData().get(key) | 97 return self._GetCachedWhatsNewData().get(key) |
98 | 98 |
99 def Cron(self): | 99 def Cron(self): |
100 return self._GenerateWhatsNewDict() | 100 return self._GenerateWhatsNewDict() |
OLD | NEW |