cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / strings_data_source.py
blob0742f0aa84ba8d45774d0ee1792cd668911caf74
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
3 # found in the LICENSE file.
5 import logging
7 from extensions_paths import JSON_TEMPLATES
8 from data_source import DataSource
11 class StringsDataSource(DataSource):
12 '''Provides templates with access to a key to string mapping defined in a
13 JSON configuration file.
14 '''
15 def __init__(self, server_instance, _):
16 self._cache = server_instance.compiled_fs_factory.ForJson(
17 server_instance.host_file_system_provider.GetMaster())
19 def _GetStringsData(self):
20 return self._cache.GetFromFile('%sstrings.json' % JSON_TEMPLATES)
22 def Refresh(self):
23 return self._GetStringsData()
25 def get(self, key):
26 string = self._GetStringsData().Get().get(key)
27 if string is None:
28 logging.warning('String "%s" not found' % key)
29 return string