Index: chrome/browser/ui/views/browser_action_view.cc |
diff --git a/chrome/browser/ui/views/browser_action_view.cc b/chrome/browser/ui/views/browser_action_view.cc |
index f4275e6ecce2a2a2f2f753ce2bb2b23b576b4c11..c101e06df528354f407716e274a6d024f391f307 100644 |
--- a/chrome/browser/ui/views/browser_action_view.cc |
+++ b/chrome/browser/ui/views/browser_action_view.cc |
@@ -62,6 +62,7 @@ BrowserActionView::BrowserActionView(const Extension* extension, |
} |
BrowserActionView::~BrowserActionView() { |
+ button_->Destroy(); |
} |
gfx::Canvas* BrowserActionView::GetIconWithBadge() { |
@@ -82,7 +83,7 @@ gfx::Canvas* BrowserActionView::GetIconWithBadge() { |
return canvas; |
} |
- |
+ |
void BrowserActionView::Layout() { |
// We can't rely on button_->GetPreferredSize() here because that's not set |
// correctly until the first call to |
@@ -96,16 +97,16 @@ void BrowserActionView::Layout() { |
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::ViewHierarchyChanged(bool is_add, |
+ View* parent, |
+ View* child) { |
+ if (is_add && (child == this)) { |
sky
2012/08/13 23:48:37
Can you also add GetWidget() != NULL && button_ ==
yefimt
2012/08/13 23:56:08
Done.
|
+ button_ = new BrowserActionButton(extension_, browser_, delegate_); |
+ button_->set_drag_controller(delegate_); |
+ button_->set_owned_by_client(); |
+ AddChildView(button_); |
+ button_->UpdateState(); |
+ } |
} |
void BrowserActionView::GetAccessibleState(ui::AccessibleViewState* state) { |
@@ -231,7 +232,6 @@ void BrowserActionButton::ShowContextMenuForView(View* source, |
return; |
} |
- menu_runner_.reset(); |
sky
2012/08/13 23:48:37
This should stay.
yefimt
2012/08/13 23:56:08
Done, but I looked how other code does it and nobo
|
SetButtonNotPushed(); |
context_menu_ = NULL; |
} |