Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/renderer/renderer_webcolorchooser_impl.h" | |
| 6 | |
| 7 #include "content/common/view_messages.h" | |
| 8 #include "content/renderer/render_view_impl.h" | |
| 9 | |
| 10 RendererWebColorChooserImpl::RendererWebColorChooserImpl( | |
| 11 RenderViewImpl* render_view, WebKit::WebColorChooserClient* client) | |
| 12 : content::RenderViewObserver(render_view), | |
| 13 client_(client) { | |
| 14 } | |
| 15 | |
| 16 RendererWebColorChooserImpl::~RendererWebColorChooserImpl() { | |
| 17 static_cast<RenderViewImpl*>(render_view())->endColorChooser(this); | |
| 18 } | |
| 19 | |
| 20 bool RendererWebColorChooserImpl::OnMessageReceived( | |
| 21 const IPC::Message& message) { | |
| 22 bool handled = true; | |
| 23 IPC_BEGIN_MESSAGE_MAP(RendererWebColorChooserImpl, message) | |
| 24 IPC_MESSAGE_HANDLER(ViewMsg_DidChooseColorResponse, | |
| 25 OnDidChooseColorResponse) | |
| 26 IPC_MESSAGE_HANDLER(ViewMsg_DidEndColorChooser, | |
| 27 OnDidEndColorChooser) | |
| 28 IPC_MESSAGE_UNHANDLED(handled = false) | |
| 29 IPC_END_MESSAGE_MAP() | |
| 30 return handled; | |
| 31 } | |
| 32 | |
| 33 void RendererWebColorChooserImpl::setSelectedColor(WebKit::WebColor color) { | |
| 34 ViewHostMsg_SetSelectedColorInColorChooser_Params ipc_params; | |
| 35 ipc_params.color = color; | |
| 36 Send(new ViewHostMsg_SetSelectedColorInColorChooser(routing_id(), | |
| 37 ipc_params)); | |
| 38 } | |
| 39 | |
| 40 void RendererWebColorChooserImpl::endChooser() { | |
| 41 static_cast<RenderViewImpl*>(render_view())->endColorChooser(this); | |
|
jam
2012/01/17 06:49:55
nit: chrome function names are CamelCase.
also, w
| |
| 42 Send(new ViewHostMsg_EndColorChooser(routing_id())); | |
| 43 if (client_.get()) | |
| 44 client_->didEndChooser(); | |
| 45 } | |
| 46 | |
| 47 void RendererWebColorChooserImpl::OnDidChooseColorResponse( | |
| 48 WebKit::WebColor color) { | |
| 49 if (client_.get()) | |
| 50 client_->didChooseColor(color); | |
| 51 } | |
| 52 | |
| 53 void RendererWebColorChooserImpl::OnDidEndColorChooser() { | |
| 54 static_cast<RenderViewImpl*>(render_view())->endColorChooser(this); | |
| 55 if (client_.get()) | |
| 56 client_->didEndChooser(); | |
| 57 } | |
| 58 | |
| 59 WebKit::WebColorChooserClient* RendererWebColorChooserImpl::client() { | |
| 60 return client_.get(); | |
| 61 } | |
| OLD | NEW |