summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extensions_service.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 18:33:30 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-08 18:33:30 +0000
commit5bfb1eb0a729e8d1adb448b0a84580564a883d2e (patch)
treebdac0bcedc000d43f2b65fedac764bfdfa4b7c60 /chrome/browser/extensions/extensions_service.cc
parentd8cc3a679233604df94571b882ac912614cb2bbe (diff)
downloadchromium_src-5bfb1eb0a729e8d1adb448b0a84580564a883d2e.zip
chromium_src-5bfb1eb0a729e8d1adb448b0a84580564a883d2e.tar.gz
chromium_src-5bfb1eb0a729e8d1adb448b0a84580564a883d2e.tar.bz2
Try one more time to check in http://codereview.chromium.org/60112
Added this test to the list of skipped purify tests as it is experience the same issue as ExtensionView test. I also found an unrelated memory leak and created a patch separately: http://codereview.chromium.org/63073 Review URL: http://codereview.chromium.org/63075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service.cc')
-rw-r--r--chrome/browser/extensions/extensions_service.cc24
1 files changed, 9 insertions, 15 deletions
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 5c836d0..942d23c 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;