summaryrefslogtreecommitdiffstats
path: root/content/browser/tab_contents/tab_contents.cc
diff options
context:
space:
mode:
authorkeishi@chromium.org <keishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 08:52:20 +0000
committerkeishi@chromium.org <keishi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-20 08:52:20 +0000
commitda854376b38ec7258bf1fcef8569a60b976fe923 (patch)
tree01b424d06eb594aef1aa5f4043ae1d414ba04604 /content/browser/tab_contents/tab_contents.cc
parent69e3c68cdb92a927e3ff97f5911ceb645f64afa9 (diff)
downloadchromium_src-da854376b38ec7258bf1fcef8569a60b976fe923.zip
chromium_src-da854376b38ec7258bf1fcef8569a60b976fe923.tar.gz
chromium_src-da854376b38ec7258bf1fcef8569a60b976fe923.tar.bz2
Implement input type=color UI
BUG=92608 TEST= Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=126889 Review URL: https://chromiumcodereview.appspot.com/9203001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/tab_contents/tab_contents.cc')
-rw-r--r--content/browser/tab_contents/tab_contents.cc43
1 files changed, 42 insertions, 1 deletions
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index bbb77d0..e924844 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"
@@ -272,7 +273,8 @@ TabContents::TabContents(content::BrowserContext* browser_context,
temporary_zoom_settings_(false),
content_restrictions_(0),
view_type_(content::VIEW_TYPE_TAB_CONTENTS),
- has_opener_(false) {
+ has_opener_(false),
+ color_chooser_(NULL) {
render_manager_.Init(browser_context, site_instance, routing_id);
view_.reset(content::GetContentClient()->browser()->
@@ -312,6 +314,9 @@ TabContents::~TabContents() {
if (dialog_creator_)
dialog_creator_->ResetJavaScriptState(this);
+ if (color_chooser_)
+ color_chooser_->End();
+
NotifyDisconnected();
// Notify any observer that have a reference on this tab contents.
@@ -558,6 +563,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()
@@ -1381,6 +1390,20 @@ bool TabContents::HasOpener() const {
return has_opener_;
}
+void TabContents::DidChooseColorInColorChooser(int color_chooser_id,
+ const SkColor& color) {
+ GetRenderViewHost()->Send(new ViewMsg_DidChooseColorResponse(
+ GetRenderViewHost()->GetRoutingID(), color_chooser_id, color));
+}
+
+void TabContents::DidEndColorChooser(int color_chooser_id) {
+ GetRenderViewHost()->Send(new ViewMsg_DidEndColorChooser(
+ GetRenderViewHost()->GetRoutingID(), color_chooser_id));
+ if (delegate_)
+ delegate_->DidEndColorChooser();
+ color_chooser_ = NULL;
+}
+
bool TabContents::FocusLocationBarByDefault() {
content::WebUI* web_ui = GetWebUIForCurrentState();
if (web_ui)
@@ -1690,6 +1713,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_->identifier())
+ color_chooser_->End();
+}
+
+void TabContents::OnSetSelectedColorInColorChooser(int color_chooser_id,
+ const SkColor& color) {
+ if (color_chooser_ &&
+ color_chooser_id == color_chooser_->identifier())
+ 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,