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

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

Issue 10834275: Fixed Issue 141873. Crash when BrowserActionButton get disabled or hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for 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 01877ec97e7a4cc41555242559ea06057161748d..d9e22a7c555544c0520193eb2a81efe8b2b03662 100644
--- a/chrome/browser/ui/views/browser_action_view.cc
+++ b/chrome/browser/ui/views/browser_action_view.cc
@@ -59,9 +59,15 @@ BrowserActionView::BrowserActionView(const Extension* extension,
delegate_(delegate),
button_(NULL),
extension_(extension) {
+ button_ = new BrowserActionButton(extension_, browser_, delegate_);
+ button_->set_drag_controller(delegate_);
+ AddChildView(button_);
+ button_->UpdateState();
}
BrowserActionView::~BrowserActionView() {
+ RemoveChildView(button_);
+ button_->Destroy();
}
gfx::Canvas* BrowserActionView::GetIconWithBadge() {
@@ -96,18 +102,6 @@ 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::GetAccessibleState(ui::AccessibleViewState* state) {
state->name = l10n_util::GetStringUTF16(
IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION);
@@ -231,7 +225,6 @@ void BrowserActionButton::ShowContextMenuForView(View* source,
return;
}
- menu_runner_.reset();
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