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

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: Used static class member 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 2f526353cfc55008d83c9a07da2d220b1bfc1f80..0e5f13b6ace35a3232c7aca2084f95bab6c33a35 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -303,7 +303,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) {
}
@@ -1946,17 +1946,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,
@@ -2305,20 +2304,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 (!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