| 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 import copy | 5 import copy |
| 6 import json | 6 import json |
| 7 import logging | |
| 8 | 7 |
| 9 import compiled_file_system as compiled_fs | 8 import compiled_file_system as compiled_fs |
| 10 from third_party.json_schema_compiler.model import UnixName | 9 from third_party.json_schema_compiler.model import UnixName |
| 11 | 10 |
| 12 class SidenavDataSource(object): | 11 class SidenavDataSource(object): |
| 13 """This class reads in and caches a JSON file representing the side navigation | 12 """This class reads in and caches a JSON file representing the side navigation |
| 14 menu. | 13 menu. |
| 15 """ | 14 """ |
| 16 class Factory(object): | 15 class Factory(object): |
| 17 def __init__(self, compiled_fs_factory, json_path): | 16 def __init__(self, compiled_fs_factory, json_path): |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 if self._AddSelected(item['items']): | 53 if self._AddSelected(item['items']): |
| 55 item['child_selected'] = True | 54 item['child_selected'] = True |
| 56 return True | 55 return True |
| 57 return False | 56 return False |
| 58 | 57 |
| 59 def get(self, key): | 58 def get(self, key): |
| 60 sidenav = copy.deepcopy(self._cache.GetFromFile( | 59 sidenav = copy.deepcopy(self._cache.GetFromFile( |
| 61 '%s/%s_sidenav.json' % (self._json_path, key))) | 60 '%s/%s_sidenav.json' % (self._json_path, key))) |
| 62 self._AddSelected(sidenav) | 61 self._AddSelected(sidenav) |
| 63 return sidenav | 62 return sidenav |
| OLD | NEW |