| 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 InstallDelayer::Action SharedModuleService::GetDelayedInstallAction( |
| 138 const Extension* extension, |
| 139 bool install_immediately) { |
| 140 ImportStatus status = SatisfyImports(extension); |
| 141 switch (status) { |
| 142 case IMPORT_STATUS_OK: |
| 143 return INSTALL; |
| 144 case IMPORT_STATUS_UNSATISFIED: |
| 145 return DELAY; |
| 146 case IMPORT_STATUS_UNRECOVERABLE: |
| 147 return ABORT; |
| 148 } |
| 149 |
| 150 NOTREACHED(); |
| 151 return INSTALL; |
| 152 } |
| 153 |
| 137 void SharedModuleService::PruneSharedModules() { | 154 void SharedModuleService::PruneSharedModules() { |
| 138 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); | 155 ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context_); |
| 139 ExtensionService* service = | 156 ExtensionService* service = |
| 140 ExtensionSystem::Get(browser_context_)->extension_service(); | 157 ExtensionSystem::Get(browser_context_)->extension_service(); |
| 141 | 158 |
| 142 ExtensionSet set_to_check; | 159 ExtensionSet set_to_check; |
| 143 set_to_check.InsertAll(registry->enabled_extensions()); | 160 set_to_check.InsertAll(registry->enabled_extensions()); |
| 144 set_to_check.InsertAll(registry->disabled_extensions()); | 161 set_to_check.InsertAll(registry->disabled_extensions()); |
| 145 set_to_check.InsertAll(*service->delayed_installs()); | 162 set_to_check.InsertAll(*service->delayed_installs()); |
| 146 | 163 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 extensions::UninstallReason reason) { | 206 extensions::UninstallReason reason) { |
| 190 // Do not call PruneSharedModules() for an uninstall that we were responsible | 207 // Do not call PruneSharedModules() for an uninstall that we were responsible |
| 191 // for. | 208 // for. |
| 192 if (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) | 209 if (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) |
| 193 return; | 210 return; |
| 194 | 211 |
| 195 PruneSharedModules(); | 212 PruneSharedModules(); |
| 196 } | 213 } |
| 197 | 214 |
| 198 } // namespace extensions | 215 } // namespace extensions |
| OLD | NEW |