diff options
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_thread.cc | 23 | ||||
-rw-r--r-- | chrome/renderer/render_thread.h | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 46711d4..3571f6d 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -40,6 +40,7 @@ #include "chrome/renderer/render_view.h" #include "chrome/renderer/renderer_webkitclient_impl.h" #include "chrome/renderer/user_script_slave.h" +#include "webkit/api/public/WebColor.h" #include "webkit/api/public/WebCache.h" #include "webkit/api/public/WebKit.h" #include "webkit/api/public/WebString.h" @@ -211,6 +212,7 @@ void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Reset, OnResetVisitedLinks) IPC_MESSAGE_HANDLER(ViewMsg_SetNextPageID, OnSetNextPageID) + IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors) // TODO(port): removed from render_messages_internal.h; // is there a new non-windows message I should add here? IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) @@ -240,6 +242,27 @@ void RenderThread::OnSetNextPageID(int32 next_page_id) { RenderView::SetNextPageID(next_page_id); } +// Called when to register CSS Color name->system color mappings. +// We update the colors one by one and then tell WebKit to refresh all render +// views. +void RenderThread::OnSetCSSColors( + const std::vector<CSSColors::CSSColorMapping>& colors) { + + size_t num_colors = colors.size(); + scoped_array<WebKit::WebColorName> color_names( + new WebKit::WebColorName[num_colors]); + scoped_array<WebKit::WebColor> web_colors(new WebKit::WebColor[num_colors]); + size_t i = 0; + for (std::vector<CSSColors::CSSColorMapping>::const_iterator it = + colors.begin(); + it != colors.end(); + ++it, ++i) { + color_names[i] = it->first; + web_colors[i] = it->second; + } + WebKit::setNamedColors(color_names.get(), web_colors.get(), num_colors); +} + void RenderThread::OnCreateNewView(gfx::NativeViewId parent_hwnd, ModalDialogEvent modal_dialog_event, const RendererPreferences& renderer_prefs, diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index c242c61..d9cd1fb 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -13,6 +13,7 @@ #include "base/task.h" #include "build/build_config.h" #include "chrome/common/child_thread.h" +#include "chrome/common/css_colors.h" #include "chrome/renderer/renderer_histogram_snapshots.h" #include "chrome/renderer/visitedlink_slave.h" @@ -126,6 +127,7 @@ class RenderThread : public RenderThreadBase, void OnPageActionsUpdated(const std::string& extension_id, const std::vector<std::string>& page_actions); void OnSetNextPageID(int32 next_page_id); + void OnSetCSSColors(const std::vector<CSSColors::CSSColorMapping>& colors); void OnCreateNewView(gfx::NativeViewId parent_hwnd, ModalDialogEvent modal_dialog_event, const RendererPreferences& renderer_prefs, |