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

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 9203001: Implement input type=color UI (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixed Created 8 years, 10 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/tab_contents/tab_contents.cc
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index d51951d7b68bdc5a92fbcd08d26d31978154bf83..cdf954101a9d6f1b777e7c24dc050b9e1e4310ee 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -38,6 +38,7 @@
#include "content/common/view_messages.h"
#include "content/port/browser/render_widget_host_view_port.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/color_chooser.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/devtools_agent_host_registry.h"
#include "content/public/browser/download_manager.h"
@@ -516,6 +517,10 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply)
IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_OpenColorChooser, OnOpenColorChooser)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_EndColorChooser, OnEndColorChooser)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SetSelectedColorInColorChooser,
+ OnSetSelectedColorInColorChooser)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -1321,6 +1326,19 @@ bool TabContents::GotResponseToLockMouseRequest(bool allowed) {
GetRenderViewHost()->GotResponseToLockMouseRequest(allowed) : false;
}
+void TabContents::DidChooseColorInColorChooser(int color_chooser_id,
+ const SkColor& color) {
+ GetRenderViewHost()->Send(new ViewMsg_DidChooseColorResponse(
+ GetRenderViewHost()->routing_id(), color_chooser_id, color));
+}
+
+void TabContents::DidEndColorChooser(int color_chooser_id) {
+ GetRenderViewHost()->Send(new ViewMsg_DidEndColorChooser(
+ GetRenderViewHost()->routing_id(), color_chooser_id));
+ delegate_->DidEndColorChooser();
+ color_chooser_ = NULL;
+}
+
bool TabContents::FocusLocationBarByDefault() {
content::WebUI* web_ui = GetWebUIForCurrentState();
if (web_ui)
@@ -1641,6 +1659,24 @@ void TabContents::OnAppCacheAccessed(const GURL& manifest_url,
AppCacheAccessed(manifest_url, blocked_by_policy));
}
+void TabContents::OnOpenColorChooser(int color_chooser_id,
+ const SkColor& color) {
+ color_chooser_ = delegate_->OpenColorChooser(this, color_chooser_id, color);
+}
+
+void TabContents::OnEndColorChooser(int color_chooser_id) {
+ if (color_chooser_ &&
+ color_chooser_id == color_chooser_->GetIdentifier())
+ color_chooser_->End();
+}
+
+void TabContents::OnSetSelectedColorInColorChooser(
+ int color_chooser_id, const SkColor& color) {
Peter Kasting 2012/03/01 20:44:18 Nit: One arg per line. First arg on above line if
keishi 2012/03/02 06:12:13 Done.
+ if (color_chooser_ &&
+ color_chooser_id == color_chooser_->GetIdentifier())
+ color_chooser_->SetSelectedColor(color);
+}
+
// Notifies the RenderWidgetHost instance about the fact that the page is
// loading, or done loading and calls the base implementation.
void TabContents::SetIsLoading(bool is_loading,

Powered by Google App Engine
This is Rietveld 408576698