diff options
-rw-r--r-- | chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_theme_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/update_recommended_dialog.h | 2 | ||||
-rw-r--r-- | ui/base/glib/glib_integers.h (renamed from ui/base/gtk/gtk_integers.h) | 12 | ||||
-rw-r--r-- | ui/base/glib/glib_signal.h | 89 | ||||
-rw-r--r-- | ui/base/gtk/gtk_signal.h | 81 | ||||
-rw-r--r-- | ui/base/gtk/tooltip_window_gtk.h | 2 | ||||
-rw-r--r-- | views/ime/character_composer.cc | 2 | ||||
-rw-r--r-- | views/ime/character_composer_unittest.cc | 2 | ||||
-rw-r--r-- | views/ime/input_method_ibus.h | 4 |
12 files changed, 107 insertions, 95 deletions
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h index 3a92b24..3394bef 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h @@ -11,7 +11,7 @@ #include "base/string16.h" #include "chrome/browser/bookmarks/bookmark_editor.h" #include "chrome/browser/bookmarks/bookmark_model_observer.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" #include "ui/base/gtk/gtk_signal.h" class GURL; diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h index c91fa03..5066baa 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_menu_controller_gtk.h @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/gtk_signal_registrar.h" #include "ui/base/gtk/owned_widget_gtk.h" diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h index 647d10c..571a3f9 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h @@ -10,7 +10,7 @@ #include <vector> #include "base/string16.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" class BookmarkModel; class BookmarkNode; diff --git a/chrome/browser/ui/gtk/gtk_theme_service.h b/chrome/browser/ui/gtk/gtk_theme_service.h index 0c5d989..7d1133b2 100644 --- a/chrome/browser/ui/gtk/gtk_theme_service.h +++ b/chrome/browser/ui/gtk/gtk_theme_service.h @@ -13,7 +13,7 @@ #include "chrome/browser/prefs/pref_change_registrar.h" #include "chrome/browser/themes/theme_service.h" #include "content/public/browser/notification_observer.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" #include "ui/gfx/color_utils.h" diff --git a/chrome/browser/ui/gtk/update_recommended_dialog.h b/chrome/browser/ui/gtk/update_recommended_dialog.h index 2c24a7e..bdcb2de 100644 --- a/chrome/browser/ui/gtk/update_recommended_dialog.h +++ b/chrome/browser/ui/gtk/update_recommended_dialog.h @@ -7,7 +7,7 @@ #pragma once #include "base/basictypes.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" #include "ui/base/gtk/gtk_signal.h" typedef struct _GtkWidget GtkWidget; diff --git a/ui/base/gtk/gtk_integers.h b/ui/base/glib/glib_integers.h index 41eeb93..4317c27 100644 --- a/ui/base/gtk/gtk_integers.h +++ b/ui/base/glib/glib_integers.h @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_BASE_GTK_GTK_INTEGERS_H_ -#define UI_BASE_GTK_GTK_INTEGERS_H_ +#ifndef UI_BASE_GLIB_GLIB_INTEGERS_H_ +#define UI_BASE_GLIB_GLIB_INTEGERS_H_ #pragma once -// 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. +// 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 glib/gtypes.h +// when we just need a gpointer. typedef char gchar; typedef short gshort; typedef long glong; @@ -25,4 +25,4 @@ typedef unsigned int guint32; typedef void* gpointer; typedef const void *gconstpointer; -#endif // UI_BASE_GTK_GTK_INTEGERS_H_ +#endif // UI_BASE_GLIB_GLIB_INTEGERS_H_ diff --git a/ui/base/glib/glib_signal.h b/ui/base/glib/glib_signal.h new file mode 100644 index 0000000..63b9306 --- /dev/null +++ b/ui/base/glib/glib_signal.h @@ -0,0 +1,89 @@ +// 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. + +#ifndef UI_BASE_GLIB_GLIB_SIGNAL_H_ +#define UI_BASE_GLIB_GLIB_SIGNAL_H_ +#pragma once + +typedef void* gpointer; + +// 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 +// MethodThunk()" which just called nonstatic Method()s on a class (which hurt +// readability of the headers and signal connection code) OR we declared +// "static Method()" and passed in the current object as the gpointer (and hurt +// readability in the implementation by having "context->" before every +// variable). + +// The hopeful result of using these macros is that the code will be more +// readable and regular. There shouldn't be a bunch of static Thunks visible in +// the headers and the implementations shouldn't be filled with "context->" +// de-references. + +#define CHROMEG_CALLBACK_0(CLASS, RETURN, METHOD, SENDER) \ + static RETURN METHOD ## Thunk(SENDER sender, gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)->METHOD(sender); \ + } \ + \ + virtual RETURN METHOD(SENDER); + +#define CHROMEG_CALLBACK_1(CLASS, RETURN, METHOD, SENDER, ARG1) \ + static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, \ + gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)->METHOD(sender, one); \ + } \ + \ + virtual RETURN METHOD(SENDER, ARG1); + +#define CHROMEG_CALLBACK_2(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2) \ + static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ + gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)->METHOD(sender, one, two); \ + } \ + \ + virtual RETURN METHOD(SENDER, ARG1, ARG2); + +#define CHROMEG_CALLBACK_3(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3) \ + static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ + ARG3 three, gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)-> \ + METHOD(sender, one, two, three); \ + } \ + \ + virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3); + +#define CHROMEG_CALLBACK_4(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3, \ + ARG4) \ + static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ + ARG3 three, ARG4 four, \ + gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)-> \ + METHOD(sender, one, two, three, four); \ + } \ + \ + virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3, ARG4); + +#define CHROMEG_CALLBACK_5(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3, \ + ARG4, ARG5) \ + static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ + ARG3 three, ARG4 four, ARG5 five, \ + gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)-> \ + METHOD(sender, one, two, three, four, five); \ + } \ + \ + virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3, ARG4, ARG5); + +#define CHROMEG_CALLBACK_6(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3, \ + ARG4, ARG5, ARG6) \ + static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ + ARG3 three, ARG4 four, ARG5 five, \ + ARG6 six, gpointer userdata) { \ + return reinterpret_cast<CLASS*>(userdata)-> \ + METHOD(sender, one, two, three, four, five, six); \ + } \ + \ + virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6); + +#endif diff --git a/ui/base/gtk/gtk_signal.h b/ui/base/gtk/gtk_signal.h index 64d59d6..a6b34cd 100644 --- a/ui/base/gtk/gtk_signal.h +++ b/ui/base/gtk/gtk_signal.h @@ -6,86 +6,9 @@ #define UI_BASE_GTK_GTK_SIGNAL_H_ #pragma once -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 -// MethodThunk()" which just called nonstatic Method()s on a class (which hurt -// readability of the headers and signal connection code) OR we declared -// "static Method()" and passed in the current object as the gpointer (and hurt -// readability in the implementation by having "context->" before every -// variable). - -// The hopeful result of using these macros is that the code will be more -// readable and regular. There shouldn't be a bunch of static Thunks visible in -// the headers and the implementations shouldn't be filled with "context->" -// de-references. - -#define CHROMEG_CALLBACK_0(CLASS, RETURN, METHOD, SENDER) \ - static RETURN METHOD ## Thunk(SENDER sender, gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)->METHOD(sender); \ - } \ - \ - virtual RETURN METHOD(SENDER); - -#define CHROMEG_CALLBACK_1(CLASS, RETURN, METHOD, SENDER, ARG1) \ - static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, \ - gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)->METHOD(sender, one); \ - } \ - \ - virtual RETURN METHOD(SENDER, ARG1); +#include "ui/base/glib/glib_signal.h" -#define CHROMEG_CALLBACK_2(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2) \ - static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ - gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)->METHOD(sender, one, two); \ - } \ - \ - virtual RETURN METHOD(SENDER, ARG1, ARG2); - -#define CHROMEG_CALLBACK_3(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3) \ - static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ - ARG3 three, gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)-> \ - METHOD(sender, one, two, three); \ - } \ - \ - virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3); - -#define CHROMEG_CALLBACK_4(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3, \ - ARG4) \ - static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ - ARG3 three, ARG4 four, \ - gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)-> \ - METHOD(sender, one, two, three, four); \ - } \ - \ - virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3, ARG4); - -#define CHROMEG_CALLBACK_5(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3, \ - ARG4, ARG5) \ - static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ - ARG3 three, ARG4 four, ARG5 five, \ - gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)-> \ - METHOD(sender, one, two, three, four, five); \ - } \ - \ - virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3, ARG4, ARG5); - -#define CHROMEG_CALLBACK_6(CLASS, RETURN, METHOD, SENDER, ARG1, ARG2, ARG3, \ - ARG4, ARG5, ARG6) \ - static RETURN METHOD ## Thunk(SENDER sender, ARG1 one, ARG2 two, \ - ARG3 three, ARG4 four, ARG5 five, \ - ARG6 six, gpointer userdata) { \ - return reinterpret_cast<CLASS*>(userdata)-> \ - METHOD(sender, one, two, three, four, five, six); \ - } \ - \ - virtual RETURN METHOD(SENDER, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6); +typedef struct _GtkWidget GtkWidget; // These macros handle the common case where the sender object will be a // GtkWidget*. diff --git a/ui/base/gtk/tooltip_window_gtk.h b/ui/base/gtk/tooltip_window_gtk.h index 52622a7..8c908e0 100644 --- a/ui/base/gtk/tooltip_window_gtk.h +++ b/ui/base/gtk/tooltip_window_gtk.h @@ -9,7 +9,7 @@ #include <string> #include "base/string16.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/ui_export.h" diff --git a/views/ime/character_composer.cc b/views/ime/character_composer.cc index 249c05a..00546d0 100644 --- a/views/ime/character_composer.cc +++ b/views/ime/character_composer.cc @@ -8,7 +8,7 @@ #include <iterator> #include "third_party/gtk+/gdk/gdkkeysyms.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" namespace { diff --git a/views/ime/character_composer_unittest.cc b/views/ime/character_composer_unittest.cc index 5e09719..254f180 100644 --- a/views/ime/character_composer_unittest.cc +++ b/views/ime/character_composer_unittest.cc @@ -6,7 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/gtk+/gdk/gdkkeysyms.h" -#include "ui/base/gtk/gtk_integers.h" +#include "ui/base/glib/glib_integers.h" namespace views { diff --git a/views/ime/input_method_ibus.h b/views/ime/input_method_ibus.h index b50d6fb..47649b4 100644 --- a/views/ime/input_method_ibus.h +++ b/views/ime/input_method_ibus.h @@ -12,8 +12,8 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "ui/base/gtk/gtk_integers.h" -#include "ui/base/gtk/gtk_signal.h" +#include "ui/base/glib/glib_integers.h" +#include "ui/base/glib/glib_signal.h" #include "views/events/event.h" #include "views/ime/character_composer.h" #include "views/ime/input_method_base.h" |