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

Side by Side Diff: chrome/common/extensions/docs/server2/server_instance.py

Issue 54603010: Docserver: Implement the content providers infrastructure, where a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jeffrey Created 7 years, 1 month 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 from api_data_source import APIDataSource 5 from api_data_source import APIDataSource
6 from api_list_data_source import APIListDataSource 6 from api_list_data_source import APIListDataSource
7 from api_models import APIModels 7 from api_models import APIModels
8 from availability_finder import AvailabilityFinder 8 from availability_finder import AvailabilityFinder
9 from compiled_file_system import CompiledFileSystem 9 from compiled_file_system import CompiledFileSystem
10 from directory_zipper import DirectoryZipper 10 from content_providers import ContentProviders
11 from empty_dir_file_system import EmptyDirFileSystem 11 from empty_dir_file_system import EmptyDirFileSystem
12 from environment import IsDevServer 12 from environment import IsDevServer
13 from features_bundle import FeaturesBundle 13 from features_bundle import FeaturesBundle
14 from github_file_system_provider import GithubFileSystemProvider 14 from github_file_system_provider import GithubFileSystemProvider
15 from host_file_system_provider import HostFileSystemProvider 15 from host_file_system_provider import HostFileSystemProvider
16 from host_file_system_iterator import HostFileSystemIterator 16 from host_file_system_iterator import HostFileSystemIterator
17 from intro_data_source import IntroDataSource 17 from intro_data_source import IntroDataSource
18 from object_store_creator import ObjectStoreCreator 18 from object_store_creator import ObjectStoreCreator
19 from path_canonicalizer import PathCanonicalizer 19 from path_canonicalizer import PathCanonicalizer
20 from redirector import Redirector
21 from reference_resolver import ReferenceResolver 20 from reference_resolver import ReferenceResolver
22 from samples_data_source import SamplesDataSource 21 from samples_data_source import SamplesDataSource
23 import svn_constants 22 import svn_constants
24 from template_renderer import TemplateRenderer 23 from template_renderer import TemplateRenderer
25 from test_branch_utility import TestBranchUtility 24 from test_branch_utility import TestBranchUtility
26 from test_object_store import TestObjectStore 25 from test_object_store import TestObjectStore
27 26
28 class ServerInstance(object): 27 class ServerInstance(object):
29 28
30 def __init__(self, 29 def __init__(self,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 126
128 self.api_data_source_factory.SetSamplesDataSourceFactory( 127 self.api_data_source_factory.SetSamplesDataSourceFactory(
129 self.samples_data_source_factory) 128 self.samples_data_source_factory)
130 129
131 self.intro_data_source_factory = IntroDataSource.Factory( 130 self.intro_data_source_factory = IntroDataSource.Factory(
132 self.compiled_fs_factory, 131 self.compiled_fs_factory,
133 host_fs_at_trunk, 132 host_fs_at_trunk,
134 self.ref_resolver_factory, 133 self.ref_resolver_factory,
135 [svn_constants.INTRO_PATH, svn_constants.ARTICLE_PATH]) 134 [svn_constants.INTRO_PATH, svn_constants.ARTICLE_PATH])
136 135
137 self.directory_zipper = DirectoryZipper(
138 self.compiled_fs_factory,
139 host_fs_at_trunk)
140
141 self.path_canonicalizer = PathCanonicalizer( 136 self.path_canonicalizer = PathCanonicalizer(
142 self.compiled_fs_factory, 137 self.compiled_fs_factory,
143 host_fs_at_trunk) 138 host_fs_at_trunk)
144 139
145 self.redirector = Redirector( 140 self.content_providers = ContentProviders(
146 self.compiled_fs_factory, 141 self.compiled_fs_factory,
147 host_fs_at_trunk, 142 host_fs_at_trunk)
148 svn_constants.PUBLIC_TEMPLATE_PATH)
149 143
150 # TODO(kalman): Move all the remaining DataSources into DataSourceRegistry, 144 # TODO(kalman): Move all the remaining DataSources into DataSourceRegistry,
151 # then factor out the DataSource creation into a factory method, so that 145 # then factor out the DataSource creation into a factory method, so that
152 # the entire ServerInstance doesn't need to be passed in here. 146 # the entire ServerInstance doesn't need to be passed in here.
153 self.template_renderer = TemplateRenderer(self) 147 self.template_renderer = TemplateRenderer(self)
154 148
155 self.strings_json_path = svn_constants.STRINGS_JSON_PATH 149 self.strings_json_path = svn_constants.STRINGS_JSON_PATH
156 self.manifest_json_path = svn_constants.MANIFEST_JSON_PATH 150 self.manifest_json_path = svn_constants.MANIFEST_JSON_PATH
157 self.manifest_features_path = svn_constants.MANIFEST_FEATURES_PATH 151 self.manifest_features_path = svn_constants.MANIFEST_FEATURES_PATH
158 152
(...skipping 13 matching lines...) Expand all
172 object_store_creator = ObjectStoreCreator(start_empty=False, 166 object_store_creator = ObjectStoreCreator(start_empty=False,
173 store_type=TestObjectStore) 167 store_type=TestObjectStore)
174 host_file_system_provider = HostFileSystemProvider.ForLocal( 168 host_file_system_provider = HostFileSystemProvider.ForLocal(
175 object_store_creator) 169 object_store_creator)
176 return ServerInstance( 170 return ServerInstance(
177 object_store_creator, 171 object_store_creator,
178 CompiledFileSystem.Factory(object_store_creator), 172 CompiledFileSystem.Factory(object_store_creator),
179 TestBranchUtility.CreateWithCannedData(), 173 TestBranchUtility.CreateWithCannedData(),
180 host_file_system_provider, 174 host_file_system_provider,
181 GithubFileSystemProvider.ForEmpty()) 175 GithubFileSystemProvider.ForEmpty())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698