| 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..787a35091252dda316409a60abd5f578b1c59d46 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) && (GetWidget() != NULL) && (button_ == NULL)) {
|
| + 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) {
|
|
|