| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/extensions/unpacked_installer.h" | 5 #include "chrome/browser/extensions/unpacked_installer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (!service || service->browser_terminating()) | 207 if (!service || service->browser_terminating()) |
| 208 return; | 208 return; |
| 209 | 209 |
| 210 // TODO(crbug.com/420147): Move this code to a utility class to avoid | 210 // TODO(crbug.com/420147): Move this code to a utility class to avoid |
| 211 // duplication of SharedModuleService::CheckImports code. | 211 // duplication of SharedModuleService::CheckImports code. |
| 212 if (SharedModuleInfo::ImportsModules(extension())) { | 212 if (SharedModuleInfo::ImportsModules(extension())) { |
| 213 const std::vector<SharedModuleInfo::ImportInfo>& imports = | 213 const std::vector<SharedModuleInfo::ImportInfo>& imports = |
| 214 SharedModuleInfo::GetImports(extension()); | 214 SharedModuleInfo::GetImports(extension()); |
| 215 std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; | 215 std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; |
| 216 for (i = imports.begin(); i != imports.end(); ++i) { | 216 for (i = imports.begin(); i != imports.end(); ++i) { |
| 217 base::Version version_required(i->minimum_version); | 217 Version version_required(i->minimum_version); |
| 218 const Extension* imported_module = | 218 const Extension* imported_module = |
| 219 service->GetExtensionById(i->extension_id, true); | 219 service->GetExtensionById(i->extension_id, true); |
| 220 if (!imported_module) { | 220 if (!imported_module) { |
| 221 ReportExtensionLoadError(kImportMissing); | 221 ReportExtensionLoadError(kImportMissing); |
| 222 return; | 222 return; |
| 223 } else if (imported_module && | 223 } else if (imported_module && |
| 224 !SharedModuleInfo::IsSharedModule(imported_module)) { | 224 !SharedModuleInfo::IsSharedModule(imported_module)) { |
| 225 ReportExtensionLoadError(kImportNotSharedModule); | 225 ReportExtensionLoadError(kImportNotSharedModule); |
| 226 return; | 226 return; |
| 227 } else if (imported_module && (version_required.IsValid() && | 227 } else if (imported_module && (version_required.IsValid() && |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 service_weak_->OnExtensionInstalled( | 369 service_weak_->OnExtensionInstalled( |
| 370 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 370 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
| 371 | 371 |
| 372 if (!callback_.is_null()) { | 372 if (!callback_.is_null()) { |
| 373 callback_.Run(extension(), extension_path_, std::string()); | 373 callback_.Run(extension(), extension_path_, std::string()); |
| 374 callback_.Reset(); | 374 callback_.Reset(); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 } // namespace extensions | 378 } // namespace extensions |
| OLD | NEW |