| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 posixpath | 5 import posixpath |
| 6 | 6 |
| 7 from compiled_file_system import Cache, SingleFile, Unicode | 7 from compiled_file_system import Cache, SingleFile, Unicode |
| 8 from extensions_paths import API_PATHS | 8 from extensions_paths import API_PATHS |
| 9 from features_bundle import HasParent, GetParentName | 9 from features_bundle import HasParent, GetParentName |
| 10 from file_system import FileNotFoundError | 10 from file_system import FileNotFoundError |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 content_script_apis[parent] = ContentScriptAPI(parent) | 164 content_script_apis[parent] = ContentScriptAPI(parent) |
| 165 if content_script_apis[parent].restrictedTo: | 165 if content_script_apis[parent].restrictedTo: |
| 166 content_script_apis[parent].restrictedTo.append(node) | 166 content_script_apis[parent].restrictedTo.append(node) |
| 167 else: | 167 else: |
| 168 content_script_apis[parent].restrictedTo = [node] | 168 content_script_apis[parent].restrictedTo = [node] |
| 169 | 169 |
| 170 self._object_store.Set('content_script_apis', content_script_apis) | 170 self._object_store.Set('content_script_apis', content_script_apis) |
| 171 return content_script_apis | 171 return content_script_apis |
| 172 return Future(callback=resolve) | 172 return Future(callback=resolve) |
| 173 | 173 |
| 174 def Cron(self): | 174 def Refresh(self): |
| 175 futures = [self.GetModel(name) for name in self.GetNames()] | 175 futures = [self.GetModel(name) for name in self.GetNames()] |
| 176 return All(futures, except_pass=(FileNotFoundError, ValueError)) | 176 return All(futures, except_pass=(FileNotFoundError, ValueError)) |
| 177 | 177 |
| 178 def IterModels(self): | 178 def IterModels(self): |
| 179 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] | 179 future_models = [(name, self.GetModel(name)) for name in self.GetNames()] |
| 180 for name, future_model in future_models: | 180 for name, future_model in future_models: |
| 181 try: | 181 try: |
| 182 model = future_model.Get() | 182 model = future_model.Get() |
| 183 except FileNotFoundError: | 183 except FileNotFoundError: |
| 184 continue | 184 continue |
| 185 if model: | 185 if model: |
| 186 yield name, model | 186 yield name, model |
| OLD | NEW |