Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2684)

Unified Diff: chrome/browser/extensions/api/extension_action/extension_actions_api.cc

Issue 10855090: extensions: Fix crash on empty extension action icons (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase more Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/extension_action/extension_actions_api.cc
diff --git a/chrome/browser/extensions/api/extension_action/extension_actions_api.cc b/chrome/browser/extensions/api/extension_action/extension_actions_api.cc
index 44ea5d4b38eb46f068a2293eaf02ca7296d7001c..7b4cd1f1ec81085d8d53513249ccdd3b1fce8854 100644
--- a/chrome/browser/extensions/api/extension_action/extension_actions_api.cc
+++ b/chrome/browser/extensions/api/extension_action/extension_actions_api.cc
@@ -104,8 +104,10 @@ void SetDefaultsFromValue(const base::DictionaryValue* dict,
action->SetAppearance(kTabId,
static_cast<ExtensionAction::Appearance>(int_value));
if (dict->GetString(kIconStorageKey, &str_value) &&
- StringToSkBitmap(str_value, &bitmap))
- action->SetIcon(kTabId, bitmap);
+ StringToSkBitmap(str_value, &bitmap)) {
+ CHECK(!bitmap.isNull());
+ action->SetIcon(kTabId, gfx::Image(bitmap));
+ }
}
// Store |action|'s default values in a DictionaryValue for use in storing to
@@ -409,7 +411,8 @@ bool ExtensionActionSetIconFunction::RunExtensionAction() {
PickleIterator iter(bitmap_pickle);
SkBitmap bitmap;
EXTENSION_FUNCTION_VALIDATE(IPC::ReadParam(&bitmap_pickle, &iter, &bitmap));
- extension_action_->SetIcon(tab_id_, bitmap);
+ CHECK(!bitmap.isNull());
+ extension_action_->SetIcon(tab_id_, gfx::Image(bitmap));
} else if (details_->GetInteger("iconIndex", &icon_index)) {
// If --enable-script-badges is on there might legitimately be an iconIndex
// set. Until we decide what to do with that, ignore.
@@ -421,7 +424,7 @@ bool ExtensionActionSetIconFunction::RunExtensionAction() {
error_ = kIconIndexOutOfBounds;
return false;
}
- extension_action_->SetIcon(tab_id_, SkBitmap());
+ extension_action_->SetIcon(tab_id_, gfx::Image());
extension_action_->SetIconIndex(tab_id_, icon_index);
} else {
EXTENSION_FUNCTION_VALIDATE(false);
« no previous file with comments | « no previous file | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698