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

Unified Diff: chrome/common/extensions/docs/server2/availability_finder.py

Issue 191853002: Revert "Doc server: support interfaces in src/extensions" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/availability_finder.py
diff --git a/chrome/common/extensions/docs/server2/availability_finder.py b/chrome/common/extensions/docs/server2/availability_finder.py
index 05303f5a2365c94b2367532f624958ad345c53da..c0cf95e9bb79f776182202d75b3a69e0b415e141 100644
--- a/chrome/common/extensions/docs/server2/availability_finder.py
+++ b/chrome/common/extensions/docs/server2/availability_finder.py
@@ -7,9 +7,7 @@ import posixpath
from api_schema_graph import APISchemaGraph
from branch_utility import BranchUtility
-from extensions_paths import (
- API, CHROME_API, JSON_TEMPLATES, API_FEATURES, MANIFEST_FEATURES,
- PERMISSION_FEATURES)
+from extensions_paths import API, JSON_TEMPLATES
from third_party.json_schema_compiler.model import UnixName
@@ -31,7 +29,7 @@ def _GetChannelFromFeatures(api_name, json_fs, filename):
given |json_fs|. Returns None if channel information for the API cannot be
located.
'''
- feature = json_fs.GetFromFile(filename).Get().get(api_name)
+ feature = json_fs.GetFromFile(API + filename).Get().get(api_name)
if feature is None:
return None
if isinstance(feature, Mapping):
@@ -43,17 +41,17 @@ def _GetChannelFromFeatures(api_name, json_fs, filename):
def _GetChannelFromApiFeatures(api_name, json_fs):
- return _GetChannelFromFeatures(api_name, json_fs, API_FEATURES)
+ return _GetChannelFromFeatures(api_name, json_fs, '_api_features.json')
def _GetChannelFromManifestFeatures(api_name, json_fs):
# _manifest_features.json uses unix_style API names.
api_name = UnixName(api_name)
- return _GetChannelFromFeatures(api_name, json_fs, MANIFEST_FEATURES)
+ return _GetChannelFromFeatures(api_name, json_fs, '_manifest_features.json')
def _GetChannelFromPermissionFeatures(api_name, json_fs):
- return _GetChannelFromFeatures(api_name, json_fs, PERMISSION_FEATURES)
+ return _GetChannelFromFeatures(api_name, json_fs, '_permission_features.json')
class AvailabilityFinder(object):
@@ -97,28 +95,24 @@ class AvailabilityFinder(object):
single _EXTENSION_API file which all APIs share in older versions of Chrome,
in which case it is unknown whether the API actually exists there.
'''
- def find_schema_under_path(api_name, path):
- # |file_system| will cache the results from the ReadSingle() call.
- if not file_system.Exists(path).Get():
- return None
- filenames = file_system.ReadSingle(path).Get()
- for ext in ('json', 'idl'):
- filename = '%s.%s' % (api_name, ext)
- if filename in filenames:
- return path + filename
- if _EXTENSION_API in filenames:
- return path + _EXTENSION_API
- # API schema data could not be found in any .json or .idl file.
- return None
+ def under_api_path(path):
+ return API + path
if version == 'trunk' or version > _ORIGINAL_FEATURES_MIN_VERSION:
# API schema filenames switch format to unix_hacker_style.
api_name = UnixName(api_name)
- filename = find_schema_under_path(api_name, API)
- if filename is not None:
- return filename
- return find_schema_under_path(api_name, CHROME_API)
+ # |file_system| will cache the results from the ReadSingle() call.
+ filenames = file_system.ReadSingle(API).Get()
+
+ for ext in ('json', 'idl'):
+ filename = '%s.%s' % (api_name, ext)
+ if filename in filenames:
+ return under_api_path(filename)
+ if _EXTENSION_API in filenames:
+ return under_api_path(_EXTENSION_API)
+ # API schema data could not be found in any .json or .idl file.
+ return None
def _GetApiSchema(self, api_name, file_system, version):
'''Searches |file_system| for |api_name|'s API schema data, and processes
« no previous file with comments | « chrome/common/extensions/docs/server2/app.yaml ('k') | chrome/common/extensions/docs/server2/content_providers_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698