Commit 67891062 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/10834275

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151148 0039d316-1c4b-4281-b951-d872f2087c98
parent eecdc10c
...@@ -59,9 +59,15 @@ BrowserActionView::BrowserActionView(const Extension* extension, ...@@ -59,9 +59,15 @@ BrowserActionView::BrowserActionView(const Extension* extension,
delegate_(delegate), delegate_(delegate),
button_(NULL), button_(NULL),
extension_(extension) { extension_(extension) {
button_ = new BrowserActionButton(extension_, browser_, delegate_);
button_->set_drag_controller(delegate_);
AddChildView(button_);
button_->UpdateState();
} }
BrowserActionView::~BrowserActionView() { BrowserActionView::~BrowserActionView() {
RemoveChildView(button_);
button_->Destroy();
} }
gfx::Canvas* BrowserActionView::GetIconWithBadge() { gfx::Canvas* BrowserActionView::GetIconWithBadge() {
...@@ -96,18 +102,6 @@ void BrowserActionView::Layout() { ...@@ -96,18 +102,6 @@ void BrowserActionView::Layout() {
BrowserActionsContainer::IconHeight()); BrowserActionsContainer::IconHeight());
} }
void BrowserActionView::ViewHierarchyChanged(bool is_add,
View* parent,
View* child) {
if (is_add && (child == this)) {
button_ = new BrowserActionButton(extension_, browser_, delegate_);
button_->set_drag_controller(delegate_);
AddChildView(button_);
button_->UpdateState();
}
}
void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) { void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) {
state->name = l10n_util::GetStringUTF16( state->name = l10n_util::GetStringUTF16(
IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION); IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION);
...@@ -231,7 +225,6 @@ void BrowserActionButton::ShowContextMenuForView(View* source, ...@@ -231,7 +225,6 @@ void BrowserActionButton::ShowContextMenuForView(View* source,
return; return;
} }
menu_runner_.reset();
SetButtonNotPushed(); SetButtonNotPushed();
context_menu_ = NULL; context_menu_ = NULL;
} }
......
...@@ -77,9 +77,6 @@ class BrowserActionView : public views::View { ...@@ -77,9 +77,6 @@ class BrowserActionView : public views::View {
protected: protected:
// Overridden from views::View to paint the badge on top of children. // Overridden from views::View to paint the badge on top of children.
virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE;
virtual void ViewHierarchyChanged(bool is_add,
View* parent,
View* child) OVERRIDE;
private: private:
// The Browser object this view is associated with. // The Browser object this view is associated with.
......
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