| 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 __getitem__(self, key): |  71   def GetAllNames(self): | 
|  72     return self.get(key) |  72     names = [] | 
 |  73     for i in ['apps', 'extensions']: | 
 |  74       for j in ['chrome', 'experimental']: | 
 |  75        names.extend(self.get(i).get(j)) | 
 |  76     return [api_name['name'] for api_name in names] | 
|  73  |  77  | 
|  74   def get(self, key): |  78   def get(self, key): | 
|  75     try: |  79     try: | 
|  76       return self._cache.GetFromFileListing(self._api_path)[key] |  80       return self._cache.GetFromFileListing(self._api_path)[key] | 
|  77     except FileNotFoundError as e: |  81     except FileNotFoundError as e: | 
|  78       raise ValueError('%s: Error listing files for "%s".' % (e, key)) |  82       raise ValueError('%s: Error listing files for "%s".' % (e, key)) | 
| OLD | NEW |