| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/extensions/shared_module_service.h" | 5 #include "chrome/browser/extensions/shared_module_service.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ++iter) { | 127 ++iter) { |
| 128 if (SharedModuleInfo::ImportsExtensionById(iter->get(), | 128 if (SharedModuleInfo::ImportsExtensionById(iter->get(), |
| 129 extension->id())) { | 129 extension->id())) { |
| 130 dependents->Insert(*iter); | 130 dependents->Insert(*iter); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 return dependents; | 134 return dependents; |
| 135 } | 135 } |
| 136 | 136 |
| 137 InstallGate::Action SharedModuleService::ShouldDelay(const Extension* extension, |
| 138 bool install_immediately) { |
| 139 ImportStatus status = SatisfyImports(extension); |
| 140 switch (status) { |
| 141 case IMPORT_STATUS_OK: |
| 142 return INSTALL; |
| 143 case IMPORT_STATUS_UNSATISFIED: |
| 144 return DELAY; |
| 145 case IMPORT_STATUS_UNRECOVERABLE: |
| 146 return ABORT; |
| 147 } |
| 148 |
| 149 NOTREACHED(); |
| 150 return INSTALL; |
| 151 } |
| 152 |
| 137 void SharedModuleService::PruneSharedModules() { | 153 void SharedModuleService::PruneSharedModules() { |
| 138 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); | 154 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); |
| 139 ExtensionService* service = | 155 ExtensionService* service = |
| 140 ExtensionSystem::Get(browser_context_)->extension_service(); | 156 ExtensionSystem::Get(browser_context_)->extension_service(); |
| 141 | 157 |
| 142 ExtensionSet set_to_check; | 158 ExtensionSet set_to_check; |
| 143 set_to_check.InsertAll(registry->enabled_extensions()); | 159 set_to_check.InsertAll(registry->enabled_extensions()); |
| 144 set_to_check.InsertAll(registry->disabled_extensions()); | 160 set_to_check.InsertAll(registry->disabled_extensions()); |
| 145 set_to_check.InsertAll(*service->delayed_installs()); | 161 set_to_check.InsertAll(*service->delayed_installs()); |
| 146 | 162 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 extensions::UninstallReason reason) { | 205 extensions::UninstallReason reason) { |
| 190 // Do not call PruneSharedModules() for an uninstall that we were responsible | 206 // Do not call PruneSharedModules() for an uninstall that we were responsible |
| 191 // for. | 207 // for. |
| 192 if (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) | 208 if (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) |
| 193 return; | 209 return; |
| 194 | 210 |
| 195 PruneSharedModules(); | 211 PruneSharedModules(); |
| 196 } | 212 } |
| 197 | 213 |
| 198 } // namespace extensions | 214 } // namespace extensions |
| OLD | NEW |