Update to Chrome47 version of GlobalMenuBarRegistrarX11

This commit is contained in:
Paul Betts 2015-12-07 14:25:52 -08:00
parent af28900189
commit 4a8d58f914
2 changed files with 15 additions and 15 deletions

View file

@ -21,7 +21,7 @@ const char kAppMenuRegistrarPath[] = "/com/canonical/AppMenu/Registrar";
// static // static
GlobalMenuBarRegistrarX11* GlobalMenuBarRegistrarX11::GetInstance() { GlobalMenuBarRegistrarX11* GlobalMenuBarRegistrarX11::GetInstance() {
return Singleton<GlobalMenuBarRegistrarX11>::get(); return base::Singleton<GlobalMenuBarRegistrarX11>::get();
} }
void GlobalMenuBarRegistrarX11::OnWindowMapped(unsigned long xid) { void GlobalMenuBarRegistrarX11::OnWindowMapped(unsigned long xid) {
@ -39,7 +39,7 @@ void GlobalMenuBarRegistrarX11::OnWindowUnmapped(unsigned long xid) {
} }
GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11() GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11()
: registrar_proxy_(NULL) { : registrar_proxy_(nullptr) {
// libdbusmenu uses the gio version of dbus; I tried using the code in dbus/, // libdbusmenu uses the gio version of dbus; I tried using the code in dbus/,
// but it looks like that's isn't sharing the bus name with the gio version, // but it looks like that's isn't sharing the bus name with the gio version,
// even when |connection_type| is set to SHARED. // even when |connection_type| is set to SHARED.
@ -49,11 +49,11 @@ GlobalMenuBarRegistrarX11::GlobalMenuBarRegistrarX11()
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS |
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START), G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START),
NULL, nullptr,
kAppMenuRegistrarName, kAppMenuRegistrarName,
kAppMenuRegistrarPath, kAppMenuRegistrarPath,
kAppMenuRegistrarName, kAppMenuRegistrarName,
NULL, // TODO: Probalby want a real cancelable. nullptr, // TODO: Probalby want a real cancelable.
static_cast<GAsyncReadyCallback>(OnProxyCreatedThunk), static_cast<GAsyncReadyCallback>(OnProxyCreatedThunk),
this); this);
} }
@ -70,7 +70,7 @@ GlobalMenuBarRegistrarX11::~GlobalMenuBarRegistrarX11() {
void GlobalMenuBarRegistrarX11::RegisterXID(unsigned long xid) { void GlobalMenuBarRegistrarX11::RegisterXID(unsigned long xid) {
DCHECK(registrar_proxy_); DCHECK(registrar_proxy_);
std::string path = atom::GlobalMenuBarX11::GetPathForWindow(xid); std::string path = GlobalMenuBarX11::GetPathForWindow(xid);
ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/314087 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/314087
// TODO(erg): The mozilla implementation goes to a lot of callback trouble // TODO(erg): The mozilla implementation goes to a lot of callback trouble
@ -84,14 +84,14 @@ void GlobalMenuBarRegistrarX11::RegisterXID(unsigned long xid) {
"RegisterWindow", "RegisterWindow",
g_variant_new("(uo)", xid, path.c_str()), g_variant_new("(uo)", xid, path.c_str()),
G_DBUS_CALL_FLAGS_NONE, -1, G_DBUS_CALL_FLAGS_NONE, -1,
NULL, nullptr,
NULL, nullptr,
NULL); nullptr);
} }
void GlobalMenuBarRegistrarX11::UnregisterXID(unsigned long xid) { void GlobalMenuBarRegistrarX11::UnregisterXID(unsigned long xid) {
DCHECK(registrar_proxy_); DCHECK(registrar_proxy_);
std::string path = atom::GlobalMenuBarX11::GetPathForWindow(xid); std::string path = GlobalMenuBarX11::GetPathForWindow(xid);
ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/314087 ANNOTATE_SCOPED_MEMORY_LEAK; // http://crbug.com/314087
// TODO(erg): The mozilla implementation goes to a lot of callback trouble // TODO(erg): The mozilla implementation goes to a lot of callback trouble
@ -105,14 +105,14 @@ void GlobalMenuBarRegistrarX11::UnregisterXID(unsigned long xid) {
"UnregisterWindow", "UnregisterWindow",
g_variant_new("(u)", xid), g_variant_new("(u)", xid),
G_DBUS_CALL_FLAGS_NONE, -1, G_DBUS_CALL_FLAGS_NONE, -1,
NULL, nullptr,
NULL, nullptr,
NULL); nullptr);
} }
void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source, void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source,
GAsyncResult* result) { GAsyncResult* result) {
GError* error = NULL; GError* error = nullptr;
GDBusProxy* proxy = g_dbus_proxy_new_for_bus_finish(result, &error); GDBusProxy* proxy = g_dbus_proxy_new_for_bus_finish(result, &error);
if (error) { if (error) {
g_error_free(error); g_error_free(error);
@ -128,7 +128,7 @@ void GlobalMenuBarRegistrarX11::OnProxyCreated(GObject* source,
g_signal_connect(registrar_proxy_, "notify::g-name-owner", g_signal_connect(registrar_proxy_, "notify::g-name-owner",
G_CALLBACK(OnNameOwnerChangedThunk), this); G_CALLBACK(OnNameOwnerChangedThunk), this);
OnNameOwnerChanged(NULL, NULL); OnNameOwnerChanged(nullptr, nullptr);
} }
void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GObject* /* ignored */, void GlobalMenuBarRegistrarX11::OnNameOwnerChanged(GObject* /* ignored */,

View file

@ -28,7 +28,7 @@ class GlobalMenuBarRegistrarX11 {
void OnWindowUnmapped(unsigned long xid); void OnWindowUnmapped(unsigned long xid);
private: private:
friend struct DefaultSingletonTraits<GlobalMenuBarRegistrarX11>; friend struct base::DefaultSingletonTraits<GlobalMenuBarRegistrarX11>;
GlobalMenuBarRegistrarX11(); GlobalMenuBarRegistrarX11();
~GlobalMenuBarRegistrarX11(); ~GlobalMenuBarRegistrarX11();