| OLD | NEW |
| 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from file_system import FileNotFoundError | 8 from file_system import FileNotFoundError |
| 9 import compiled_file_system as compiled_fs | 9 import compiled_file_system as compiled_fs |
| 10 import third_party.json_schema_compiler.model as model | 10 import third_party.json_schema_compiler.model as model |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 'extensions': self._GetAPIsInSubdirectory(api_names, 'extensions') | 61 'extensions': self._GetAPIsInSubdirectory(api_names, 'extensions') |
| 62 } | 62 } |
| 63 | 63 |
| 64 def Create(self): | 64 def Create(self): |
| 65 return APIListDataSource(self._cache, self._api_path) | 65 return APIListDataSource(self._cache, self._api_path) |
| 66 | 66 |
| 67 def __init__(self, cache, api_path): | 67 def __init__(self, cache, api_path): |
| 68 self._cache = cache | 68 self._cache = cache |
| 69 self._api_path = api_path | 69 self._api_path = api_path |
| 70 | 70 |
| 71 def GetAllNames(self): |
| 72 names = [] |
| 73 for i in ['apps', 'extensions']: |
| 74 for j in ['chrome', 'experimental']: |
| 75 names.extend(self[i][j]) |
| 76 return [api_name['name'].replace('experimental.', '') for api_name in names] |
| 77 |
| 71 def __getitem__(self, key): | 78 def __getitem__(self, key): |
| 72 return self.get(key) | 79 return self.get(key) |
| 73 | 80 |
| 74 def get(self, key): | 81 def get(self, key): |
| 75 try: | 82 try: |
| 76 return self._cache.GetFromFileListing(self._api_path)[key] | 83 return self._cache.GetFromFileListing(self._api_path)[key] |
| 77 except FileNotFoundError as e: | 84 except FileNotFoundError as e: |
| 78 raise ValueError('%s: Error listing files for "%s".' % (e, key)) | 85 raise ValueError('%s: Error listing files for "%s".' % (e, key)) |
| OLD | NEW |