Make WebContentsDelegate::OpenColorChooser return NULL on failure
Changing WebContentsDelegate::OpenColorChooser to return NULL on failure so we don't put the same ColorChooser into two scoped_ptrs(WebContentsImpl::color_chooser_)
BUG=331790
Review URL: https://codereview.chromium.org/128053002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244710 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 125276b..f6a2ff0a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2455,8 +2455,10 @@
const std::vector<ColorSuggestion>& suggestions) {
ColorChooser* new_color_chooser =
delegate_->OpenColorChooser(this, color, suggestions);
- if (color_chooser_ == new_color_chooser)
+ if (!new_color_chooser)
return;
+ if (color_chooser_)
+ color_chooser_->End();
color_chooser_.reset(new_color_chooser);
color_chooser_identifier_ = color_chooser_id;
}