diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-25 19:38:21 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-25 19:38:21 +0000 |
commit | 811f3431f0066d9c4d94deb8af113df65dd67d6a (patch) | |
tree | 48c57cf6d66dbd27216e0717e9a779e22fbacf25 /chrome/browser | |
parent | aa1d08e331f9155a1dc0dccd59ddb78d51bd31d4 (diff) | |
download | chromium_src-811f3431f0066d9c4d94deb8af113df65dd67d6a.zip chromium_src-811f3431f0066d9c4d94deb8af113df65dd67d6a.tar.gz chromium_src-811f3431f0066d9c4d94deb8af113df65dd67d6a.tar.bz2 |
* notify theme loading with --load-extension
* fix crasher in theme parsing with no images
Review URL: http://codereview.chromium.org/160124
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 2810b66..0ef074c 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -483,6 +483,15 @@ void ExtensionsService::OnExtensionsLoaded(ExtensionList* new_extensions) { NotificationType::EXTENSIONS_LOADED, Source<ExtensionsService>(this), Details<ExtensionList>(&enabled_extensions)); + for (ExtensionList::iterator iter = enabled_extensions.begin(); + iter != enabled_extensions.end(); ++iter) { + if ((*iter)->IsTheme() && (*iter)->location() == Extension::LOAD) { + NotificationService::current()->Notify( + NotificationType::THEME_INSTALLED, + Source<ExtensionsService>(this), + Details<Extension>(*iter)); + } + } } } @@ -755,19 +764,21 @@ Extension* ExtensionsServiceBackend::LoadExtension( // Theme resource validation. if (extension->IsTheme()) { DictionaryValue* images_value = extension->GetThemeImages(); - DictionaryValue::key_iterator iter = images_value->begin_keys(); - while (iter != images_value->end_keys()) { - std::string val; - if (images_value->GetString(*iter , &val)) { - FilePath image_path = extension->path().AppendASCII(val); - if (!file_util::PathExists(image_path)) { - ReportExtensionLoadError(extension_path, - StringPrintf("Could not load '%s' for theme.", - WideToUTF8(image_path.ToWStringHack()).c_str())); - return NULL; + if (images_value) { + DictionaryValue::key_iterator iter = images_value->begin_keys(); + while (iter != images_value->end_keys()) { + std::string val; + if (images_value->GetString(*iter , &val)) { + FilePath image_path = extension->path().AppendASCII(val); + if (!file_util::PathExists(image_path)) { + ReportExtensionLoadError(extension_path, + StringPrintf("Could not load '%s' for theme.", + WideToUTF8(image_path.ToWStringHack()).c_str())); + return NULL; + } } + ++iter; } - ++iter; } // Themes cannot contain other extension types. |