Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: trunk/src/chrome/common/extensions/docs/server2/sidenav_data_source.py

Issue 14712010: Revert 199633 "Doc server manifest page generation" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
9 import compiled_file_system as compiled_fs
10 from third_party.json_schema_compiler.model import UnixName
7 11
8 class SidenavDataSource(object): 12 class SidenavDataSource(object):
9 """This class reads in and caches a JSON file representing the side navigation 13 """This class reads in and caches a JSON file representing the side navigation
10 menu. 14 menu.
11 """ 15 """
12 class Factory(object): 16 class Factory(object):
13 def __init__(self, compiled_fs_factory, json_path): 17 def __init__(self, compiled_fs_factory, json_path):
14 self._cache = compiled_fs_factory.Create(self._CreateSidenavDict, 18 self._cache = compiled_fs_factory.Create(self._CreateSidenavDict,
15 SidenavDataSource) 19 SidenavDataSource)
16 self._json_path = json_path 20 self._json_path = json_path
(...skipping 29 matching lines...) Expand all
46 if item.get('fileName', '') == self._file_name: 50 if item.get('fileName', '') == self._file_name:
47 item['selected'] = True 51 item['selected'] = True
48 return True 52 return True
49 if 'items' in item: 53 if 'items' in item:
50 if self._AddSelected(item['items']): 54 if self._AddSelected(item['items']):
51 item['child_selected'] = True 55 item['child_selected'] = True
52 return True 56 return True
53 return False 57 return False
54 58
55 def get(self, key): 59 def get(self, key):
56 sidenav_items = copy.deepcopy(self._cache.GetFromFile( 60 sidenav = copy.deepcopy(self._cache.GetFromFile(
57 '%s/%s_sidenav.json' % (self._json_path, key))) 61 '%s/%s_sidenav.json' % (self._json_path, key)))
58 self._AddSelected(sidenav_items) 62 self._AddSelected(sidenav)
59 return sidenav_items 63 return sidenav
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698