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..4fca20a8ee7735431b9708c438da2d101078d033 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() |
@@ -527,6 +532,31 @@ bool TabContents::OnMessageReceived(const IPC::Message& message) { |
return handled; |
} |
+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_ && |
+ GetRenderViewHost() == color_chooser_->GetRenderViewHost() && |
jam
2012/02/27 22:06:25
why is this check necessary, i.e. shouldn't the id
keishi
2012/02/28 11:27:45
You're right. Removed.
|
+ color_chooser_id == color_chooser_->GetIdentifier()) |
+ color_chooser_->End(); |
+} |
+ |
+void TabContents::OnSetSelectedColorInColorChooser( |
+ int color_chooser_id, const SkColor& color) { |
+ if (color_chooser_ && |
+ GetRenderViewHost() == color_chooser_->GetRenderViewHost() && |
+ color_chooser_id == color_chooser_->GetIdentifier()) |
+ color_chooser_->SetSelectedColor(color); |
+} |
+ |
+void TabContents::DidEndColorChooser() { |
+ color_chooser_ = NULL; |
+ delegate_->DidEndColorChooser(); |
+} |
+ |
void TabContents::RunFileChooser( |
RenderViewHost* render_view_host, |
const content::FileChooserParams& params) { |