Index: chrome/browser/extensions/extensions_service.cc |
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc |
index 5c836d09008094ae4e5d8e6c147f7ebd7bd043f8..942d23ca73e4b8648ec295e3d664aee1ae4bff99 100644 |
--- a/chrome/browser/extensions/extensions_service.cc |
+++ b/chrome/browser/extensions/extensions_service.cc |
@@ -258,18 +258,9 @@ void ExtensionsServiceBackend::LoadSingleExtension( |
LOG(INFO) << "Loading single extension from " << |
WideToASCII(extension_path.BaseName().ToWStringHack()); |
- Extension* extension = LoadExtension(extension_path); |
+ Extension* extension = LoadExtension(extension_path, |
+ false); // don't require ID |
if (extension) { |
- if (extension->id().empty()) { |
- // Generate an ID |
- static int counter = 0; |
- std::string id = StringPrintf("%x", counter); |
- ++counter; |
- |
- // pad the string out to 40 chars with zeroes. |
- id.insert(0, 40 - id.length(), '0'); |
- extension->set_id(id); |
- } |
ExtensionList* extensions = new ExtensionList; |
extensions->push_back(extension); |
ReportExtensionsLoaded(extensions); |
@@ -290,11 +281,12 @@ Extension* ExtensionsServiceBackend::LoadExtensionCurrentVersion( |
WideToASCII(extension_path.BaseName().ToWStringHack()) << |
" version: " << version_str; |
- return LoadExtension(extension_path.AppendASCII(version_str)); |
+ return LoadExtension(extension_path.AppendASCII(version_str), |
+ true); // require id |
} |
Extension* ExtensionsServiceBackend::LoadExtension( |
- const FilePath& extension_path) { |
+ const FilePath& extension_path, bool require_id) { |
FilePath manifest_path = |
extension_path.AppendASCII(Extension::kManifestFilename); |
if (!file_util::PathExists(manifest_path)) { |
@@ -317,7 +309,7 @@ Extension* ExtensionsServiceBackend::LoadExtension( |
scoped_ptr<Extension> extension(new Extension(extension_path)); |
if (!extension->InitFromValue(*static_cast<DictionaryValue*>(root.get()), |
- &error)) { |
+ require_id, &error)) { |
ReportExtensionLoadError(extension_path, error); |
return NULL; |
} |
@@ -638,7 +630,9 @@ bool ExtensionsServiceBackend::InstallOrUpdateExtension( |
DictionaryValue* dict = manifest.get(); |
Extension extension; |
std::string error; |
- if (!extension.InitFromValue(*dict, &error)) { |
+ if (!extension.InitFromValue(*dict, |
+ true, // require ID |
+ &error)) { |
ReportExtensionInstallError(source_file, |
"Invalid extension manifest."); |
return false; |