Adding the orphaned options pages to the navigation
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / data_source_registry.py
blob43161e320854ed10e8fc3b24767201608ab73462
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 from api_data_source import APIDataSource
6 from api_list_data_source import APIListDataSource
7 from data_source import DataSource
8 from manifest_data_source import ManifestDataSource
9 from owners_data_source import OwnersDataSource
10 from permissions_data_source import PermissionsDataSource
11 from samples_data_source import SamplesDataSource
12 from sidenav_data_source import SidenavDataSource
13 from strings_data_source import StringsDataSource
14 from template_data_source import (
15 ArticleDataSource, IntroDataSource, PartialDataSource)
16 from whats_new_data_source import WhatsNewDataSource
19 _all_data_sources = {
20 'apis': APIDataSource,
21 'api_list': APIListDataSource,
22 'articles': ArticleDataSource,
23 'intros': IntroDataSource,
24 'manifest_source': ManifestDataSource,
25 'owners': OwnersDataSource,
26 'partials': PartialDataSource,
27 'permissions': PermissionsDataSource,
28 'samples': SamplesDataSource,
29 'sidenavs': SidenavDataSource,
30 'strings': StringsDataSource,
31 'whatsNew' : WhatsNewDataSource
35 assert all(issubclass(cls, DataSource)
36 for cls in _all_data_sources.itervalues())
39 def GetDataSourceNames():
40 return _all_data_sources.keys()
43 def CreateDataSource(name, server_instance, request=None):
44 '''Create a single DataSource by name.'''
45 assert name in _all_data_sources
46 return _all_data_sources[name](server_instance, request)
49 def CreateDataSources(server_instance, request=None):
50 '''Create a dictionary of initialized DataSources. DataSources are
51 initialized with |server_instance| and |request|. If the DataSources are
52 going to be used for Refresh, |request| should be omitted.
54 The key of each DataSource is the name the template system will use to access
55 the DataSource.
56 '''
57 return dict((name, cls(server_instance, request))
58 for name, cls in _all_data_sources.iteritems())