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 c0cf95e9bb79f776182202d75b3a69e0b415e141..ffa85293f727971d26477b65e6c8cec9ab411e81 100644 |
--- a/chrome/common/extensions/docs/server2/availability_finder.py |
+++ b/chrome/common/extensions/docs/server2/availability_finder.py |
@@ -7,7 +7,7 @@ import posixpath |
from api_schema_graph import APISchemaGraph |
from branch_utility import BranchUtility |
-from extensions_paths import API, JSON_TEMPLATES |
+from extensions_paths import API, CORE_API, JSON_TEMPLATES |
from third_party.json_schema_compiler.model import UnixName |
@@ -95,24 +95,28 @@ 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 under_api_path(path): |
- return API + path |
+ 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 |
if version == 'trunk' or version > _ORIGINAL_FEATURES_MIN_VERSION: |
# API schema filenames switch format to unix_hacker_style. |
api_name = UnixName(api_name) |
- # |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 |
+ filename = find_schema_under_path(api_name, CORE_API) |
+ if filename is not None: |
+ return filename |
+ return find_schema_under_path(api_name, API) |
def _GetApiSchema(self, api_name, file_system, version): |
'''Searches |file_system| for |api_name|'s API schema data, and processes |