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

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

Issue 10821087: Fix color chooser cleanup process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | ui/views/color_chooser/color_chooser_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/color_chooser_aura.cc
diff --git a/chrome/browser/ui/views/color_chooser_aura.cc b/chrome/browser/ui/views/color_chooser_aura.cc
index 514c4b640b32d04793504e70d03968337f00120a..52f6a0ae2ce6342a51c4056a249c744cedb2c52b 100644
--- a/chrome/browser/ui/views/color_chooser_aura.cc
+++ b/chrome/browser/ui/views/color_chooser_aura.cc
@@ -47,6 +47,7 @@ ColorChooserAura::ColorChooserAura(int identifier,
SkColor initial_color)
: ColorChooser(identifier),
tab_(tab) {
+ DCHECK(tab_);
view_ = new views::ColorChooserView(this, initial_color);
widget_ = views::Widget::CreateWindow(view_);
widget_->SetAlwaysOnTop(true);
@@ -54,23 +55,24 @@ ColorChooserAura::ColorChooserAura(int identifier,
}
void ColorChooserAura::OnColorChosen(SkColor color) {
- if (tab_)
- tab_->DidChooseColorInColorChooser(identifier(), color);
+ tab_->DidChooseColorInColorChooser(identifier(), color);
}
void ColorChooserAura::OnColorChooserDialogClosed() {
- if (tab_)
- tab_->DidEndColorChooser(identifier());
view_ = NULL;
widget_ = NULL;
+ tab_->DidEndColorChooser(identifier());
}
void ColorChooserAura::End() {
if (widget_ && widget_->IsVisible()) {
+ view_->set_listener(NULL);
widget_->Close();
- tab_ = NULL;
view_ = NULL;
widget_ = NULL;
+ // DidEndColorChooser will invoke Browser::DidEndColorChooser, which deletes
+ // this. Take care of the call order.
+ tab_->DidEndColorChooser(identifier());
}
}
« no previous file with comments | « no previous file | ui/views/color_chooser/color_chooser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698