Skip to content

Commit

Permalink
Move TooltipWindowGtk from views/widget to ui/base/gtk.
Browse files Browse the repository at this point in the history
TooltipWidgetGtk is a gtk based helper class that replaces a widget's default tooltip with a RGBA friendly version. It's not closely coupled with views and ui/base/gtk seems to be a better home for it.

This move gets rid of RenderWidgetHostViewGtk's dependency on views.

BUG=none.
TEST=Expect no change. ChromeOS's tooltip should still have rounded corners.

Review URL: http://codereview.chromium.org/7753038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98475 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
xiyuan@chromium.org committed Aug 26, 2011
1 parent d8472d9 commit 916dc1c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions content/browser/renderer_host/render_widget_host_view_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "webkit/plugins/npapi/webplugin.h"

#if defined(OS_CHROMEOS)
#include "views/widget/tooltip_window_gtk.h"
#include "ui/base/gtk/tooltip_window_gtk.h"
#else
#include "content/browser/renderer_host/gtk_key_bindings_handler.h"
#endif // defined(OS_CHROMEOS)
Expand Down Expand Up @@ -901,7 +901,7 @@ void RenderWidgetHostViewGtk::DoSharedInit() {
im_context_.reset(new GtkIMContextWrapper(this));
plugin_container_manager_.set_host_widget(view_.get());
#if defined(OS_CHROMEOS)
tooltip_window_.reset(new views::TooltipWindowGtk(view_.get()));
tooltip_window_.reset(new ui::TooltipWindowGtk(view_.get()));
#else
key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get()));
#endif
Expand Down
4 changes: 2 additions & 2 deletions content/browser/renderer_host/render_widget_host_view_gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class GtkIMContextWrapper;
struct NativeWebKeyboardEvent;

#if defined(OS_CHROMEOS)
namespace views {
namespace ui {
class TooltipWindowGtk;
}
#else
Expand Down Expand Up @@ -269,7 +269,7 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,

#if defined(OS_CHROMEOS)
// Custimized tooltip window.
scoped_ptr<views::TooltipWindowGtk> tooltip_window_;
scoped_ptr<ui::TooltipWindowGtk> tooltip_window_;
#endif // defined(OS_CHROMEOS)
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "views/widget/tooltip_window_gtk.h"
#include "ui/base/gtk/tooltip_window_gtk.h"

#include <gtk/gtk.h>

#include "base/utf_string_conversions.h"

namespace views {
namespace ui {

TooltipWindowGtk::TooltipWindowGtk(GtkWidget* widget)
: host_(widget),
Expand Down Expand Up @@ -92,4 +92,4 @@ void TooltipWindowGtk::OnStyleSet(GtkWidget* widget,
gtk_widget_queue_draw(widget);
}

} // namespace views
} // namespace ui
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_
#define VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_
#ifndef UI_BASE_GTK_TOOLTIP_WINDOW_GTK_H_
#define UI_BASE_GTK_TOOLTIP_WINDOW_GTK_H_
#pragma once

#include <string>

#include "base/basictypes.h"
#include "ui/base/gtk/gtk_integers.h"
#include "ui/base/gtk/gtk_signal.h"
#include "views/views_export.h"
#include "ui/base/ui_export.h"

typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GtkLabel GtkLabel;
typedef struct _GtkWidget GtkWidget;
typedef struct _GtkStyle GtkStyle;

namespace views {
namespace ui {

// TooltipWindowGtk provides a customized tooltip window and gives us a
// chance to apply RGBA colormap on it. This enables the GTK theme engine to
// draw tooltip with nice shadow and rounded corner on ChromeOS.
class VIEWS_EXPORT TooltipWindowGtk {
class UI_EXPORT TooltipWindowGtk {
public:
explicit TooltipWindowGtk(GtkWidget* widget);
virtual ~TooltipWindowGtk();
Expand Down Expand Up @@ -53,6 +53,6 @@ class VIEWS_EXPORT TooltipWindowGtk {
DISALLOW_COPY_AND_ASSIGN(TooltipWindowGtk);
};

} // namespace views
} // namespace ui

#endif // VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_
#endif // UI_BASE_GTK_TOOLTIP_WINDOW_GTK_H_
2 changes: 2 additions & 0 deletions ui/ui.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@
'base/gtk/gtk_windowing.h',
'base/gtk/owned_widget_gtk.cc',
'base/gtk/owned_widget_gtk.h',
'base/gtk/tooltip_window_gtk.cc',
'base/gtk/tooltip_window_gtk.h',
'base/ime/composition_text.cc',
'base/ime/composition_text.h',
'base/ime/composition_underline.h',
Expand Down
2 changes: 0 additions & 2 deletions views/views.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,6 @@
'widget/tooltip_manager_win.h',
'widget/tooltip_manager.cc',
'widget/tooltip_manager.h',
'widget/tooltip_window_gtk.cc',
'widget/tooltip_window_gtk.h',
'widget/monitor_win.cc',
'widget/monitor_win.h',
'widget/native_widget.h',
Expand Down
6 changes: 3 additions & 3 deletions views/widget/tooltip_manager_gtk.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -8,8 +8,8 @@

#include <gtk/gtk.h>

#include "ui/base/gtk/tooltip_window_gtk.h"
#include "views/widget/tooltip_manager.h"
#include "views/widget/tooltip_window_gtk.h"

namespace views {

Expand Down Expand Up @@ -43,7 +43,7 @@ class TooltipManagerGtk : public TooltipManager {
View* keyboard_view_;

// Customized tooltip window.
TooltipWindowGtk tooltip_window_;
ui::TooltipWindowGtk tooltip_window_;

DISALLOW_COPY_AND_ASSIGN(TooltipManagerGtk);
};
Expand Down

0 comments on commit 916dc1c

Please sign in to comment.