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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 13150004: Support color chooser inside extesions, apps, chrome frame, dev tool (Closed) Base URL: http://git.chromium.org/chromium/src.git@ngcolor
Patch Set: Removed chrome/browser/ui/color_chooser.cc Created 7 years, 8 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
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index a6ac27b17f0516ee794a0e37b6f1b079a3c09698..9e4e438a7c74a366e09d324858ba0aa0c712955d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -304,7 +304,7 @@ WebContentsImpl::WebContentsImpl(
maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)),
temporary_zoom_settings_(false),
content_restrictions_(0),
- color_chooser_(NULL),
+ color_chooser_identifier_(0),
message_source_(NULL),
fullscreen_widget_routing_id_(MSG_ROUTING_NONE) {
}
@@ -1920,17 +1920,16 @@ bool WebContentsImpl::HasOpener() const {
return opener_ != NULL;
}
-void WebContentsImpl::DidChooseColorInColorChooser(int color_chooser_id,
- SkColor color) {
+void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) {
Send(new ViewMsg_DidChooseColorResponse(
- GetRoutingID(), color_chooser_id, color));
+ GetRoutingID(), color_chooser_identifier_, color));
}
-void WebContentsImpl::DidEndColorChooser(int color_chooser_id) {
- Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id));
- if (delegate_)
- delegate_->DidEndColorChooser();
- color_chooser_ = NULL;
+void WebContentsImpl::DidEndColorChooser() {
+ Send(new ViewMsg_DidEndColorChooser(GetRoutingID(),
+ color_chooser_identifier_));
+ color_chooser_.reset();
+ color_chooser_identifier_ = 0;
}
int WebContentsImpl::DownloadImage(const GURL& url,
@@ -2276,20 +2275,23 @@ void WebContentsImpl::OnAppCacheAccessed(const GURL& manifest_url,
void WebContentsImpl::OnOpenColorChooser(int color_chooser_id,
SkColor color) {
- color_chooser_ = delegate_ ?
- delegate_->OpenColorChooser(this, color_chooser_id, color) : NULL;
+ ColorChooser* new_color_chooser = delegate_->OpenColorChooser(this, color);
+ if (color_chooser_ == new_color_chooser)
+ return;
+ color_chooser_.reset(new_color_chooser);
+ color_chooser_identifier_ = color_chooser_id;
}
void WebContentsImpl::OnEndColorChooser(int color_chooser_id) {
if (color_chooser_ &&
- color_chooser_id == color_chooser_->identifier())
+ color_chooser_id == color_chooser_identifier_)
color_chooser_->End();
}
void WebContentsImpl::OnSetSelectedColorInColorChooser(int color_chooser_id,
SkColor color) {
if (color_chooser_ &&
- color_chooser_id == color_chooser_->identifier())
+ color_chooser_id == color_chooser_identifier_)
color_chooser_->SetSelectedColor(color);
}

Powered by Google App Engine
This is Rietveld 408576698