Index: chrome/common/extensions/docs/server2/api_models.py |
diff --git a/chrome/common/extensions/docs/server2/api_models.py b/chrome/common/extensions/docs/server2/api_models.py |
index 1875a1e329ac15732de66e410272265e32496bb4..3de7b16453af44d92539f67bc249f4e6d3d835db 100644 |
--- a/chrome/common/extensions/docs/server2/api_models.py |
+++ b/chrome/common/extensions/docs/server2/api_models.py |
@@ -6,7 +6,7 @@ import os |
import posixpath |
from compiled_file_system import SingleFile, Unicode |
-from extensions_paths import API |
+from extensions_paths import API, CHROME_API |
from file_system import FileNotFoundError |
from future import Gettable, Future |
from schema_util import ProcessSchema |
@@ -20,7 +20,6 @@ def _CreateAPIModel(path, data): |
if not schema: return None |
return Namespace(schema, schema['namespace']) |
- |
not at google - send to devlin
2014/03/07 01:04:52
this is actually python style [guide] apparently
Ken Rockot(use gerrit already)
2014/03/07 07:07:09
Done.
|
class APIModels(object): |
'''Tracks APIs and their Models. |
''' |
@@ -45,11 +44,14 @@ class APIModels(object): |
# Callers sometimes specify a filename which includes .json or .idl - if |
# so, believe them. They may even include the 'api/' prefix. |
if os.path.splitext(api_name)[1] in ('.json', '.idl'): |
- if not api_name.startswith(API): |
- api_name = posixpath.join(API, api_name) |
+ if not api_name.startswith(API) and not api_name.startswith(CHROME_API): |
not at google - send to devlin
2014/03/07 01:04:52
if not api_name.startswith((API, CHROME_API)):
Ken Rockot(use gerrit already)
2014/03/07 07:07:09
Done.
|
+ api_path = posixpath.join(API, api_name) |
+ if self._model_cache.FileExists(api_path).Get(): |
not at google - send to devlin
2014/03/07 01:04:52
rather than adding a new method here, hold onto |f
Ken Rockot(use gerrit already)
2014/03/07 07:07:09
Done.
|
+ return self._model_cache.GetFromFile(api_path) |
+ api_name = posixpath.join(CHROME_API, api_name) |
return self._model_cache.GetFromFile(api_name) |
- assert not api_name.startswith(API) |
+ assert not api_name.startswith(API) and not api_name.startswith(CHROME_API) |
not at google - send to devlin
2014/03/07 01:04:52
ditto
Ken Rockot(use gerrit already)
2014/03/07 07:07:09
Done.
|
# API names are given as declarativeContent and app.window but file names |
# will be declarative_content and app_window. |
@@ -63,14 +65,15 @@ class APIModels(object): |
basename.replace('devtools_' , ''))) |
futures = [self._model_cache.GetFromFile( |
- posixpath.join(API, '%s.%s' % (file_name, ext))) |
- for ext in ('json', 'idl')] |
+ posixpath.join(api_path, '%s.%s' % (file_name, ext))) |
+ for ext in ('json', 'idl') |
+ for api_path in (API, CHROME_API)] |
def resolve(): |
for future in futures: |
try: |
return future.Get() |
except FileNotFoundError: pass |
- # Propagate the first FileNotFoundError if neither were found. |
+ # Propagate the first FileNotFoundError if no files were found. |
futures[0].Get() |
return Future(delegate=Gettable(resolve)) |