Commit 6526c740 authored by yefim@chromium.org's avatar yefim@chromium.org

Fixed Issue 141873. Crash when BrowserActionButton get disabled or hidden.

BUG=141873
TEST=Try to disable or hide extension buttons, should not crash.


Review URL: https://chromiumcodereview.appspot.com/10826262

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151550 0039d316-1c4b-4281-b951-d872f2087c98
parent 52df030d
......@@ -49,6 +49,7 @@ BrowserActionView::BrowserActionView(const Extension* extension,
}
BrowserActionView::~BrowserActionView() {
button_->Destroy();
}
gfx::ImageSkia BrowserActionView::GetIconWithBadge() {
......@@ -78,10 +79,10 @@ void BrowserActionView::Layout() {
void BrowserActionView::ViewHierarchyChanged(bool is_add,
View* parent,
View* child) {
if (is_add && (child == this)) {
if (is_add && (child == this) && (GetWidget() != NULL) && (button_ == NULL)) {
button_ = new BrowserActionButton(extension_, browser_, delegate_);
button_->set_drag_controller(delegate_);
button_->set_owned_by_client();
AddChildView(button_);
button_->UpdateState();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment