diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-08 21:28:04 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-08 21:28:04 +0000 |
commit | 284f766950396abce8f0672c2ccde6b45de25578 (patch) | |
tree | a711fe12c1c3ac2aa83e1392f667cdff8b07221f | |
parent | b3f2f32e4cdf73df0073930cef7b4d3531df8e5d (diff) | |
download | chromium_src-284f766950396abce8f0672c2ccde6b45de25578.zip chromium_src-284f766950396abce8f0672c2ccde6b45de25578.tar.gz chromium_src-284f766950396abce8f0672c2ccde6b45de25578.tar.bz2 |
GTK: Minimize usage of gtk headers.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2891006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51898 0039d316-1c4b-4281-b951-d872f2087c98
26 files changed, 220 insertions, 125 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi index 966bf15..9c23cd2 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -41,8 +41,9 @@ 'sources!': [ 'gtk_dnd_util.cc', 'gtk_dnd_util.h', - 'gtk_signal.cc', 'gtk_signal.h', + 'gtk_signal_registrar.cc', + 'gtk_signal_registrar.h', 'gtk_util.cc', 'gtk_util.h', 'x11_util.cc', @@ -137,8 +138,9 @@ 'gfx/gl/gl_mock.h', 'gtk_dnd_util.cc', 'gtk_dnd_util.h', - 'gtk_signal.cc', 'gtk_signal.h', + 'gtk_signal_registrar.cc', + 'gtk_signal_registrar.h', 'gtk_util.cc', 'gtk_util.h', 'l10n_util.cc', diff --git a/app/gtk_integers.h b/app/gtk_integers.h new file mode 100644 index 0000000..7a95847 --- /dev/null +++ b/app/gtk_integers.h @@ -0,0 +1,27 @@ +// Copyright (c) 2010 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. + +#ifndef APP_GTK_INTEGERS_H_ +#define APP_GTK_INTEGERS_H_ + +// GLib/Gobject/Gtk all use their own integer typedefs. They are copied here +// for forward declaration reasons so we don't pull in all of gtk.h when we +// just need a gpointer. +typedef char gchar; +typedef short gshort; +typedef long glong; +typedef int gint; +typedef gint gboolean; +typedef unsigned char guchar; +typedef unsigned short gushort; +typedef unsigned long gulong; +typedef unsigned int guint; + +typedef unsigned short guint16; +typedef unsigned int guint32; + +typedef void* gpointer; +typedef const void *gconstpointer; + +#endif // APP_GTK_INTEGERS_H_ diff --git a/app/gtk_signal.h b/app/gtk_signal.h index ffa487b..a3d5f7a 100644 --- a/app/gtk_signal.h +++ b/app/gtk_signal.h @@ -5,11 +5,8 @@ #ifndef APP_GTK_SIGNAL_H_ #define APP_GTK_SIGNAL_H_ -#include <gtk/gtk.h> -#include <map> -#include <vector> - -#include "base/basictypes.h" +typedef void* gpointer; +typedef struct _GtkWidget GtkWidget; // At the time of writing this, there were two common ways of binding our C++ // code to the gobject C system. We either defined a whole bunch of "static @@ -116,52 +113,4 @@ CHROMEG_CALLBACK_6(CLASS, RETURN, METHOD, GtkWidget*, ARG1, ARG2, ARG3, \ ARG4, ARG5, ARG6); -// A class that ensures that callbacks don't run on stale owner objects. Similar -// in spirit to NotificationRegistrar. Use as follows: -// -// class ChromeObject { -// public: -// ChromeObject() { -// ... -// -// signals_.Connect(widget, "event", CallbackThunk, this); -// } -// -// ... -// -// private: -// GtkSignalRegistrar signals_; -// }; -// -// When |signals_| goes down, it will disconnect the handlers connected via -// Connect. -class GtkSignalRegistrar { - public: - GtkSignalRegistrar(); - ~GtkSignalRegistrar(); - - // Connect before the default handler. Returns the handler id. - glong Connect(gpointer instance, const gchar* detailed_signal, - GCallback signal_handler, gpointer data); - // Connect after the default handler. Returns the handler id. - glong ConnectAfter(gpointer instance, const gchar* detailed_signal, - GCallback signal_handler, gpointer data); - - private: - static void WeakNotifyThunk(gpointer data, GObject* where_the_object_was) { - reinterpret_cast<GtkSignalRegistrar*>(data)->WeakNotify( - where_the_object_was); - } - void WeakNotify(GObject* where_the_object_was); - - glong ConnectInternal(gpointer instance, const gchar* detailed_signal, - GCallback signal_handler, gpointer data, bool after); - - typedef std::vector<glong> HandlerList; - typedef std::map<GObject*, HandlerList> HandlerMap; - HandlerMap handler_lists_; - - DISALLOW_COPY_AND_ASSIGN(GtkSignalRegistrar); -}; - #endif // APP_GTK_SIGNAL_H_ diff --git a/app/gtk_signal.cc b/app/gtk_signal_registrar.cc index 4db611d..5530405 100644 --- a/app/gtk_signal.cc +++ b/app/gtk_signal_registrar.cc @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" + +#include <glib-object.h> #include "base/logging.h" diff --git a/app/gtk_signal_registrar.h b/app/gtk_signal_registrar.h new file mode 100644 index 0000000..3f14dbe --- /dev/null +++ b/app/gtk_signal_registrar.h @@ -0,0 +1,66 @@ +// Copyright (c) 2010 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. + +#ifndef APP_GTK_SIGNAL_REGISTRAR_H_ +#define APP_GTK_SIGNAL_REGISTRAR_H_ + +#include <glib.h> +#include <map> +#include <vector> + +#include "base/basictypes.h" + +typedef void (*GCallback) (void); +typedef struct _GObject GObject; +typedef struct _GtkWidget GtkWidget; + +// A class that ensures that callbacks don't run on stale owner objects. Similar +// in spirit to NotificationRegistrar. Use as follows: +// +// class ChromeObject { +// public: +// ChromeObject() { +// ... +// +// signals_.Connect(widget, "event", CallbackThunk, this); +// } +// +// ... +// +// private: +// GtkSignalRegistrar signals_; +// }; +// +// When |signals_| goes down, it will disconnect the handlers connected via +// Connect. +class GtkSignalRegistrar { + public: + GtkSignalRegistrar(); + ~GtkSignalRegistrar(); + + // Connect before the default handler. Returns the handler id. + glong Connect(gpointer instance, const gchar* detailed_signal, + GCallback signal_handler, gpointer data); + // Connect after the default handler. Returns the handler id. + glong ConnectAfter(gpointer instance, const gchar* detailed_signal, + GCallback signal_handler, gpointer data); + + private: + static void WeakNotifyThunk(gpointer data, GObject* where_the_object_was) { + reinterpret_cast<GtkSignalRegistrar*>(data)->WeakNotify( + where_the_object_was); + } + void WeakNotify(GObject* where_the_object_was); + + glong ConnectInternal(gpointer instance, const gchar* detailed_signal, + GCallback signal_handler, gpointer data, bool after); + + typedef std::vector<glong> HandlerList; + typedef std::map<GObject*, HandlerList> HandlerMap; + HandlerMap handler_lists_; + + DISALLOW_COPY_AND_ASSIGN(GtkSignalRegistrar); +}; + +#endif // APP_GTK_SIGNAL_REGISTRAR_H_ diff --git a/base/basictypes.h b/base/basictypes.h index 8d405b25..2fc5538 100644 --- a/base/basictypes.h +++ b/base/basictypes.h @@ -360,5 +360,4 @@ namespace base { enum LinkerInitialized { LINKER_INITIALIZED }; } // base - #endif // BASE_BASICTYPES_H_ diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.h b/chrome/browser/gtk/bookmark_bubble_gtk.h index 0ca7043..c58b224 100644 --- a/chrome/browser/gtk/bookmark_bubble_gtk.h +++ b/chrome/browser/gtk/bookmark_bubble_gtk.h @@ -12,8 +12,6 @@ #ifndef CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ #define CHROME_BROWSER_GTK_BOOKMARK_BUBBLE_GTK_H_ -#include <gtk/gtk.h> - #include <string> #include <vector> @@ -30,6 +28,9 @@ class BookmarkNode; class Profile; class RecentlyUsedFoldersComboModel; +typedef struct _GtkWidget GtkWidget; +typedef struct _GParamSpec GParamSpec; + class BookmarkBubbleGtk : public InfoBubbleGtkDelegate, public NotificationObserver { public: diff --git a/chrome/browser/gtk/bookmark_editor_gtk.h b/chrome/browser/gtk/bookmark_editor_gtk.h index f835b0e..af9a984 100644 --- a/chrome/browser/gtk/bookmark_editor_gtk.h +++ b/chrome/browser/gtk/bookmark_editor_gtk.h @@ -5,10 +5,9 @@ #ifndef CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ #define CHROME_BROWSER_GTK_BOOKMARK_EDITOR_GTK_H_ -#include <gtk/gtk.h> - #include <string> +#include "app/gtk_integers.h" #include "app/gtk_signal.h" #include "base/gtest_prod_util.h" #include "chrome/browser/bookmarks/bookmark_editor.h" @@ -16,6 +15,12 @@ class GURL; +typedef union _GdkEvent GdkEvent; +typedef struct _GtkTreeIter GtkTreeIter; +typedef struct _GtkTreeSelection GtkTreeSelection; +typedef struct _GtkTreeStore GtkTreeStore; +typedef struct _GtkWidget GtkWidget; + // GTK version of the bookmark editor dialog. class BookmarkEditorGtk : public BookmarkEditor, public BookmarkModelObserver { diff --git a/chrome/browser/gtk/bookmark_menu_controller_gtk.h b/chrome/browser/gtk/bookmark_menu_controller_gtk.h index 1a31416..cf0a512 100644 --- a/chrome/browser/gtk/bookmark_menu_controller_gtk.h +++ b/chrome/browser/gtk/bookmark_menu_controller_gtk.h @@ -5,10 +5,9 @@ #ifndef CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ #define CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ -#include <gtk/gtk.h> - #include <map> +#include "app/gtk_integers.h" #include "app/gtk_signal.h" #include "base/scoped_ptr.h" #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" @@ -24,6 +23,11 @@ class BookmarkModel; class BookmarkNode; class MenuGtk; +typedef struct _GdkDragContext GdkDragContext; +typedef struct _GdkEventButton GdkEventButton; +typedef struct _GtkSelectionData GtkSelectionData; +typedef struct _GtkWidget GtkWidget; + class BookmarkMenuController : public BaseBookmarkModelObserver, public BookmarkContextMenuControllerDelegate { public: diff --git a/chrome/browser/gtk/bookmark_utils_gtk.h b/chrome/browser/gtk/bookmark_utils_gtk.h index 6c2227c..6619461 100644 --- a/chrome/browser/gtk/bookmark_utils_gtk.h +++ b/chrome/browser/gtk/bookmark_utils_gtk.h @@ -5,15 +5,21 @@ #ifndef CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ #define CHROME_BROWSER_GTK_BOOKMARK_UTILS_GTK_H_ -#include <gtk/gtk.h> #include <vector> #include <string> +#include "app/gtk_integers.h" + class BookmarkModel; class BookmarkNode; class GtkThemeProvider; class Profile; +typedef struct _GdkDragContext GdkDragContext; +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _GtkSelectionData GtkSelectionData; +typedef struct _GtkWidget GtkWidget; + namespace bookmark_utils { extern const char kBookmarkNode[]; diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/gtk/browser_actions_toolbar_gtk.h index e26b555..262b81d 100644 --- a/chrome/browser/gtk/browser_actions_toolbar_gtk.h +++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.h @@ -5,12 +5,11 @@ #ifndef CHROME_BROWSER_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ #define CHROME_BROWSER_GTK_BROWSER_ACTIONS_TOOLBAR_GTK_H_ -#include <gtk/gtk.h> - #include <map> #include <string> #include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" #include "app/menus/simple_menu_model.h" #include "app/slide_animation.h" #include "base/linked_ptr.h" @@ -28,6 +27,7 @@ class Extension; class GtkThemeProvider; class Profile; +typedef struct _GdkDragContext GdkDragContext; typedef struct _GtkWidget GtkWidget; class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer, diff --git a/chrome/browser/gtk/cairo_cached_surface.cc b/chrome/browser/gtk/cairo_cached_surface.cc index 19ec295..bb5ae41 100644 --- a/chrome/browser/gtk/cairo_cached_surface.cc +++ b/chrome/browser/gtk/cairo_cached_surface.cc @@ -4,6 +4,8 @@ #include "chrome/browser/gtk/cairo_cached_surface.h" +#include <gtk/gtk.h> + #include "base/basictypes.h" #include "base/logging.h" diff --git a/chrome/browser/gtk/cairo_cached_surface.h b/chrome/browser/gtk/cairo_cached_surface.h index 2c0b4d3..0a2c256 100644 --- a/chrome/browser/gtk/cairo_cached_surface.h +++ b/chrome/browser/gtk/cairo_cached_surface.h @@ -5,7 +5,9 @@ #ifndef CHROME_BROWSER_GTK_CAIRO_CACHED_SURFACE_H_ #define CHROME_BROWSER_GTK_CAIRO_CACHED_SURFACE_H_ -#include <gtk/gtk.h> +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _cairo cairo_t; +typedef struct _cairo_surface cairo_surface_t; // A helper class that takes a GdkPixbuf* and renders it to the screen. Unlike // gdk_cairo_set_source_pixbuf(), CairoCachedSurface assumes that the pixbuf is diff --git a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h b/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h index 0b9c90e..b81348e 100644 --- a/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h +++ b/chrome/browser/gtk/fullscreen_exit_bubble_gtk.h @@ -5,13 +5,13 @@ #ifndef CHROME_BROWSER_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_ #define CHROME_BROWSER_GTK_FULLSCREEN_EXIT_BUBBLE_GTK_H_ -#include <gtk/gtk.h> - #include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" #include "base/timer.h" #include "chrome/browser/gtk/slide_animator_gtk.h" typedef struct _GtkFloatingContainer GtkFloatingContainer; +typedef struct _GtkWidget GtkWidget; // FullscreenExitBubbleGTK is responsible for showing a bubble atop the screen // in fullscreen mode, telling users how to exit and providing a click target. diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 79d45cd..0f8a254 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -8,6 +8,7 @@ #include <set> +#include "app/gtk_signal_registrar.h" #include "app/resource_bundle.h" #include "base/env_var.h" #include "base/stl_util-inl.h" @@ -187,6 +188,45 @@ void PickButtonTintFromColors(const GdkColor& accent_gdk_color, } } + +// Builds and tints the image with |id| to the GtkStateType |state| and +// places the result in |icon_set|. +void BuildIconFromIDRWithColor(int id, + GtkStyle* style, + GtkStateType state, + GtkIconSet* icon_set) { + SkColor color = GdkToSkColor(&style->fg[state]); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + SkBitmap original = *rb.GetBitmapNamed(id); + + SkBitmap fill_color; + fill_color.setConfig(SkBitmap::kARGB_8888_Config, + original.width(), original.height(), 0); + fill_color.allocPixels(); + fill_color.eraseColor(color); + SkBitmap masked = SkBitmapOperations::CreateMaskedBitmap( + fill_color, original); + + GtkIconSource* icon = gtk_icon_source_new(); + GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&masked); + gtk_icon_source_set_pixbuf(icon, pixbuf); + g_object_unref(pixbuf); + + gtk_icon_source_set_direction_wildcarded(icon, TRUE); + gtk_icon_source_set_size_wildcarded(icon, TRUE); + + gtk_icon_source_set_state(icon, state); + // All fields default to wildcarding being on and setting a property doesn't + // turn off wildcarding. You need to do this yourself. This is stated once in + // the documentation in the gtk_icon_source_new() function, and no where else. + gtk_icon_source_set_state_wildcarded( + icon, state == GTK_STATE_NORMAL); + + gtk_icon_set_add_source(icon_set, icon); + gtk_icon_source_free(icon); +} + + } // namespace GtkWidget* GtkThemeProvider::icon_widget_ = NULL; @@ -202,6 +242,7 @@ GtkThemeProvider::GtkThemeProvider() : BrowserThemeProvider(), fake_window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)), fake_frame_(meta_frames_new()), + signals_(new GtkSignalRegistrar), fullscreen_icon_set_(NULL) { fake_label_.Own(gtk_label_new("")); fake_entry_.Own(gtk_entry_new()); @@ -212,8 +253,8 @@ GtkThemeProvider::GtkThemeProvider() // properties, too, which we query for some colors. gtk_widget_realize(fake_frame_); gtk_widget_realize(fake_window_); - signals_.Connect(fake_frame_, "style-set", - G_CALLBACK(&OnStyleSetThunk), this); + signals_->Connect(fake_frame_, "style-set", + G_CALLBACK(&OnStyleSetThunk), this); } GtkThemeProvider::~GtkThemeProvider() { @@ -313,8 +354,8 @@ GtkWidget* GtkThemeProvider::BuildChromeButton() { gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); chrome_buttons_.push_back(button); - signals_.Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), - this); + signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), + this); return button; } @@ -325,8 +366,8 @@ GtkWidget* GtkThemeProvider::CreateToolbarSeparator() { kSeparatorPadding, kSeparatorPadding, kSeparatorPadding, 0); gtk_container_add(GTK_CONTAINER(alignment), separator); - signals_.Connect(separator, "expose-event", - G_CALLBACK(OnSeparatorExposeThunk), this); + signals_->Connect(separator, "expose-event", + G_CALLBACK(OnSeparatorExposeThunk), this); return alignment; } @@ -793,41 +834,6 @@ void GtkThemeProvider::RebuildMenuIconSets() { fullscreen_icon_set_); } -void GtkThemeProvider::BuildIconFromIDRWithColor(int id, - GtkStyle* style, - GtkStateType state, - GtkIconSet* icon_set) { - SkColor color = GdkToSkColor(&style->fg[state]); - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - SkBitmap original = *rb.GetBitmapNamed(id); - - SkBitmap fill_color; - fill_color.setConfig(SkBitmap::kARGB_8888_Config, - original.width(), original.height(), 0); - fill_color.allocPixels(); - fill_color.eraseColor(color); - SkBitmap masked = SkBitmapOperations::CreateMaskedBitmap( - fill_color, original); - - GtkIconSource* icon = gtk_icon_source_new(); - GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&masked); - gtk_icon_source_set_pixbuf(icon, pixbuf); - g_object_unref(pixbuf); - - gtk_icon_source_set_direction_wildcarded(icon, TRUE); - gtk_icon_source_set_size_wildcarded(icon, TRUE); - - gtk_icon_source_set_state(icon, state); - // All fields default to wildcarding being on and setting a property doesn't - // turn off wildcarding. You need to do this yourself. This is stated once in - // the documentation in the gtk_icon_source_new() function, and no where else. - gtk_icon_source_set_state_wildcarded( - icon, state == GTK_STATE_NORMAL); - - gtk_icon_set_add_source(icon_set, icon); - gtk_icon_source_free(icon); -} - void GtkThemeProvider::SetThemeColorFromGtk(int id, const GdkColor* color) { colors_[id] = GdkToSkColor(color); } diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h index edc5ce7..031c5c0 100644 --- a/chrome/browser/gtk/gtk_theme_provider.h +++ b/chrome/browser/gtk/gtk_theme_provider.h @@ -5,20 +5,29 @@ #ifndef CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ #define CHROME_BROWSER_GTK_GTK_THEME_PROVIDER_H_ -#include <gtk/gtk.h> #include <map> #include <string> #include <vector> +#include "app/gtk_integers.h" #include "app/gtk_signal.h" +#include "base/scoped_ptr.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/common/notification_observer.h" #include "chrome/common/owned_widget_gtk.h" #include "gfx/color_utils.h" class CairoCachedSurface; +class GtkSignalRegistrar; class Profile; +typedef struct _GdkDisplay GdkDisplay; +typedef struct _GdkEventExpose GdkEventExpose; +typedef struct _GdkPixbuf GdkPixbuf; +typedef struct _GtkIconSet GtkIconSet; +typedef struct _GtkStyle GtkStyle; +typedef struct _GtkWidget GtkWidget; + // Specialization of BrowserThemeProvider which supplies system colors. class GtkThemeProvider : public BrowserThemeProvider, public NotificationObserver { @@ -153,13 +162,6 @@ class GtkThemeProvider : public BrowserThemeProvider, // the menus are always rendered with gtk colors. void RebuildMenuIconSets(); - // Builds and tints the image with |id| to the GtkStateType |state| and - // places the result in |icon_set|. - void BuildIconFromIDRWithColor(int id, - GtkStyle* style, - GtkStateType state, - GtkIconSet* icon_set); - // Sets the underlying theme colors/tints from a GTK color. void SetThemeColorFromGtk(int id, const GdkColor* color); void SetThemeTintFromGtk(int id, const GdkColor* color); @@ -225,7 +227,7 @@ class GtkThemeProvider : public BrowserThemeProvider, std::vector<GtkWidget*> chrome_buttons_; // Tracks all the signals we have connected to on various widgets. - GtkSignalRegistrar signals_; + scoped_ptr<GtkSignalRegistrar> signals_; // Tints and colors calculated by LoadGtkValues() that are given to the // caller while |use_gtk_| is true. diff --git a/chrome/browser/gtk/hover_controller_gtk.h b/chrome/browser/gtk/hover_controller_gtk.h index 10196ad..5a4cd9c 100644 --- a/chrome/browser/gtk/hover_controller_gtk.h +++ b/chrome/browser/gtk/hover_controller_gtk.h @@ -8,6 +8,7 @@ #include <gtk/gtk.h> #include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" #include "app/slide_animation.h" #include "app/throb_animation.h" #include "base/scoped_ptr.h" diff --git a/chrome/browser/gtk/info_bubble_gtk.h b/chrome/browser/gtk/info_bubble_gtk.h index bb49bfb..d13a965 100644 --- a/chrome/browser/gtk/info_bubble_gtk.h +++ b/chrome/browser/gtk/info_bubble_gtk.h @@ -16,6 +16,7 @@ #include <gtk/gtk.h> #include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" #include "base/basictypes.h" #include "chrome/common/notification_registrar.h" #include "gfx/point.h" diff --git a/chrome/browser/gtk/menu_bar_helper.cc b/chrome/browser/gtk/menu_bar_helper.cc index d5d42ae..1e85475c 100644 --- a/chrome/browser/gtk/menu_bar_helper.cc +++ b/chrome/browser/gtk/menu_bar_helper.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "app/gtk_signal_registrar.h" #include "base/logging.h" #include "chrome/browser/gtk/gtk_util.h" diff --git a/chrome/browser/gtk/menu_bar_helper.h b/chrome/browser/gtk/menu_bar_helper.h index 05d6819..99ac541 100644 --- a/chrome/browser/gtk/menu_bar_helper.h +++ b/chrome/browser/gtk/menu_bar_helper.h @@ -16,6 +16,8 @@ #include "app/gtk_signal.h" #include "base/scoped_ptr.h" +class GtkSignalRegistrar; + class MenuBarHelper { public: class Delegate { diff --git a/chrome/browser/gtk/rounded_window.cc b/chrome/browser/gtk/rounded_window.cc index 2783045..053f9ad 100644 --- a/chrome/browser/gtk/rounded_window.cc +++ b/chrome/browser/gtk/rounded_window.cc @@ -8,6 +8,7 @@ #include <math.h> #include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" #include "base/i18n/rtl.h" #include "chrome/browser/gtk/gtk_util.h" diff --git a/chrome/browser/gtk/tab_contents_drag_source.h b/chrome/browser/gtk/tab_contents_drag_source.h index d11e4e1..a885fed 100644 --- a/chrome/browser/gtk/tab_contents_drag_source.h +++ b/chrome/browser/gtk/tab_contents_drag_source.h @@ -8,6 +8,7 @@ #include <gtk/gtk.h> #include "app/gtk_signal.h" +#include "app/gtk_signal_registrar.h" #include "base/basictypes.h" #include "base/file_path.h" #include "base/message_loop.h" diff --git a/chrome/browser/gtk/update_recommended_dialog.cc b/chrome/browser/gtk/update_recommended_dialog.cc index 6264639..e2ab33e 100644 --- a/chrome/browser/gtk/update_recommended_dialog.cc +++ b/chrome/browser/gtk/update_recommended_dialog.cc @@ -4,6 +4,8 @@ #include "chrome/browser/gtk/update_recommended_dialog.h" +#include <gtk/gtk.h> + #include "app/l10n_util.h" #include "app/message_box_flags.h" #include "chrome/browser/browser_list.h" diff --git a/chrome/browser/gtk/update_recommended_dialog.h b/chrome/browser/gtk/update_recommended_dialog.h index fd6ca4f..94e32c8 100644 --- a/chrome/browser/gtk/update_recommended_dialog.h +++ b/chrome/browser/gtk/update_recommended_dialog.h @@ -5,9 +5,12 @@ #ifndef CHROME_BROWSER_GTK_UPDATE_RECOMMENDED_DIALOG_H_ #define CHROME_BROWSER_GTK_UPDATE_RECOMMENDED_DIALOG_H_ -#include <gtk/gtk.h> - +#include "app/gtk_integers.h" #include "app/gtk_signal.h" +#include "base/basictypes.h" + +typedef struct _GtkWidget GtkWidget; +typedef struct _GtkWindow GtkWindow; class UpdateRecommendedDialog { public: diff --git a/views/widget/tooltip_window_gtk.cc b/views/widget/tooltip_window_gtk.cc index 3b8bed7..444e67e 100644 --- a/views/widget/tooltip_window_gtk.cc +++ b/views/widget/tooltip_window_gtk.cc @@ -4,6 +4,8 @@ #include "views/widget/tooltip_window_gtk.h" +#include <gtk/gtk.h> + #include "base/utf_string_conversions.h" namespace views { @@ -27,6 +29,10 @@ void TooltipWindowGtk::SetTooltipText(const std::wstring& text) { gtk_label_set_text(label(), utf8.c_str()); } +GtkLabel* TooltipWindowGtk::label() { + return GTK_LABEL(label_); +} + void TooltipWindowGtk::Init() { // Creates and setup tooltip window. window_ = gtk_window_new(GTK_WINDOW_POPUP); diff --git a/views/widget/tooltip_window_gtk.h b/views/widget/tooltip_window_gtk.h index 556fa67..3ba0c20 100644 --- a/views/widget/tooltip_window_gtk.h +++ b/views/widget/tooltip_window_gtk.h @@ -5,10 +5,16 @@ #ifndef VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ #define VIEWS_WIDGET_TOOLTIP_WINDOW_GTK_H_ -#include <gtk/gtk.h> #include <string> +#include "app/gtk_integers.h" #include "app/gtk_signal.h" +#include "base/basictypes.h" + +typedef struct _GdkEventExpose GdkEventExpose; +typedef struct _GtkLabel GtkLabel; +typedef struct _GtkWidget GtkWidget; +typedef struct _GtkStyle GtkStyle; namespace views { @@ -23,9 +29,7 @@ class TooltipWindowGtk { // Sets tooltip text to display. void SetTooltipText(const std::wstring& text); - GtkLabel* label() { - return GTK_LABEL(label_); - } + GtkLabel* label(); protected: CHROMEGTK_CALLBACK_1(TooltipWindowGtk, gboolean, OnPaint, GdkEventExpose*); |