2013-12-18 21:02:49 +00:00
|
|
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
|
|
|
// Copyright (c) 2013 Patrick Reynolds <piki@github.com>. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE-CHROMIUM file.
|
|
|
|
|
|
|
|
#ifndef BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_LINUX_H_
|
|
|
|
#define BRIGHTRAY_BROWSER_NOTIFICATION_PRESENTER_LINUX_H_
|
|
|
|
|
|
|
|
#include <libnotify/notify.h>
|
|
|
|
#include <map>
|
|
|
|
|
2013-12-19 19:06:05 +00:00
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "browser/notification_presenter.h"
|
|
|
|
|
2013-12-18 21:02:49 +00:00
|
|
|
namespace brightray {
|
|
|
|
|
|
|
|
class NotificationPresenterLinux : public NotificationPresenter {
|
|
|
|
public:
|
2013-12-19 05:05:19 +00:00
|
|
|
NotificationPresenterLinux();
|
|
|
|
~NotificationPresenterLinux();
|
|
|
|
|
2013-12-18 21:02:49 +00:00
|
|
|
virtual void ShowNotification(
|
|
|
|
const content::ShowDesktopNotificationHostMsgParams&,
|
|
|
|
int render_process_id,
|
|
|
|
int render_view_id) OVERRIDE;
|
|
|
|
virtual void CancelNotification(
|
|
|
|
int render_process_id,
|
|
|
|
int render_view_id,
|
|
|
|
int notification_id) OVERRIDE;
|
|
|
|
|
2013-12-19 05:14:08 +00:00
|
|
|
void RemoveNotification(NotifyNotification *notification);
|
2013-12-19 05:05:19 +00:00
|
|
|
|
2013-12-18 21:02:49 +00:00
|
|
|
private:
|
2013-12-19 05:14:08 +00:00
|
|
|
// A list of all open NotifyNotification objects.
|
|
|
|
// We do lookups here both by NotifyNotification object (when the user
|
|
|
|
// clicks a notification) and by the <process,view,notification> ID
|
|
|
|
// tuple (when the browser asks to dismiss a notification). So it's not
|
|
|
|
// a map.
|
|
|
|
// Entries in this list count as refs, so removal from this list should
|
|
|
|
// always go with g_object_unref().
|
2013-12-19 05:05:19 +00:00
|
|
|
GList *notifications_;
|
2013-12-18 21:02:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace brightray
|
|
|
|
|
|
|
|
#endif
|