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

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: Fixed android build Created 7 years, 7 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 | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/color_chooser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d8e4d6e21caa423232c2a17eca697dcb5679e589..5f879d15e2d7e5f6594cad85c897b743b5e10f56 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -316,7 +316,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) {
}
@@ -1972,17 +1972,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,
@@ -2328,20 +2327,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);
}
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/public/browser/color_chooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698