Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3372)

Unified Diff: app/gtk_signal_registrar.h

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/gtk_signal.h ('k') | app/gtk_signal_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/gtk_signal_registrar.h
===================================================================
--- app/gtk_signal_registrar.h (revision 71854)
+++ app/gtk_signal_registrar.h (working copy)
@@ -1,68 +0,0 @@
-// 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_
-#pragma once
-
-#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:
- typedef std::vector<glong> HandlerList;
- typedef std::map<GObject*, HandlerList> HandlerMap;
-
- 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);
-
- HandlerMap handler_lists_;
-
- DISALLOW_COPY_AND_ASSIGN(GtkSignalRegistrar);
-};
-
-#endif // APP_GTK_SIGNAL_REGISTRAR_H_
« no previous file with comments | « app/gtk_signal.h ('k') | app/gtk_signal_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698