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

Unified Diff: chrome/browser/ui/views/browser_action_view.cc

Issue 10826262: Fixed Issue 141873. Crash when BrowserActionButton get disabled or hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Issue 141873 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 | « chrome/browser/ui/views/browser_action_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « chrome/browser/ui/views/browser_action_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698