From 02c85d999829634b21c4471246472e2353871df3 Mon Sep 17 00:00:00 2001 From: "xiyuan@chromium.org" Date: Wed, 28 Apr 2010 20:29:41 +0000 Subject: Use customized RGBA-enabled tooltip window for tooltip on ChroemOS - Add a TooltipWindowGtk which uses RGBA colormap and has a label; - Use TooltipWindowGtk for tooltip for both WidgetGtk and RenderWidgetHostViewGtk After this change, we will get back shadow and rounded corner for tooltip in theme engine. BUG=none TEST=none Review URL: http://codereview.chromium.org/1708015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45854 0039d316-1c4b-4281-b951-d872f2087c98 --- .../renderer_host/render_widget_host_view_gtk.cc | 17 +++++++++++++++++ .../browser/renderer_host/render_widget_host_view_gtk.h | 11 +++++++++++ 2 files changed, 28 insertions(+) (limited to 'chrome/browser/renderer_host') diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 403480b..f0ec3a5 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -39,6 +39,10 @@ #include "third_party/WebKit/WebKit/chromium/public/gtk/WebInputEventFactory.h" #include "webkit/glue/webcursor_gtk_data.h" +#if defined(OS_CHROMEOS) +#include "views/widget/tooltip_window_gtk.h" +#endif // defined(OS_CHROMEOS) + static const int kMaxWindowWidth = 4000; static const int kMaxWindowHeight = 4000; @@ -349,6 +353,11 @@ void RenderWidgetHostViewGtk::InitAsChild() { // |key_bindings_handler_| must be created after creating |view_| widget. key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get())); plugin_container_manager_.set_host_widget(view_.get()); + +#if defined(OS_CHROMEOS) + tooltip_window_.reset(new views::TooltipWindowGtk(view_.get())); +#endif // defined(OS_CHROMEOS) + gtk_widget_show(view_.get()); } @@ -363,6 +372,11 @@ void RenderWidgetHostViewGtk::InitAsPopup( // |key_bindings_handler_| must be created after creating |view_| widget. key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get())); plugin_container_manager_.set_host_widget(view_.get()); + +#if defined(OS_CHROMEOS) + tooltip_window_.reset(new views::TooltipWindowGtk(view_.get())); +#endif // defined(OS_CHROMEOS) + gtk_container_add(GTK_CONTAINER(popup), view_.get()); // If we are not activatable, we don't want to grab keyboard input, @@ -608,6 +622,9 @@ void RenderWidgetHostViewGtk::SetTooltipText(const std::wstring& tooltip_text) { } else { gtk_widget_set_tooltip_text(view_.get(), WideToUTF8(clamped_tooltip).c_str()); +#if defined(OS_CHROMEOS) + tooltip_window_->SetTooltipText(clamped_tooltip); +#endif // defined(OS_CHROMEOS) } } diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h index e5939b5..3f9d90d 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h @@ -26,6 +26,12 @@ class GtkKeyBindingsHandler; class MenuGtk; struct NativeWebKeyboardEvent; +#if defined(OS_CHROMEOS) +namespace views { +class TooltipWindowGtk; +} +#endif // defined(OS_CHROMEOS) + typedef struct _GtkClipboard GtkClipboard; typedef struct _GtkSelectionData GtkSelectionData; @@ -179,6 +185,11 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView { // The size that we want the renderer to be. We keep this in a separate // variable because resizing in GTK+ is async. gfx::Size requested_size_; + +#if defined(OS_CHROMEOS) + // Custimized tooltip window. + scoped_ptr tooltip_window_; +#endif // defined(OS_CHROMEOS) }; #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ -- cgit v1.1