blob: 4509bacf246003defe0fb2d4ad2a91c51358c7a9 [file] [log] [blame]
// Copyright 2014 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.
#include <stdint.h>
#include <string>
#include "base/callback_forward.h"
#include "content/common/content_export.h"
#include "content/public/common/persistent_notification_status.h"
class GURL;
namespace content {
class BrowserContext;
struct PlatformNotificationData;
// This is the dispatcher to be used for firing events related to persistent
// notifications on a Service Worker. This class is a singleton, the instance of
// which can be retrieved using the static GetInstance() method. All methods
// must be called on the UI thread.
class CONTENT_EXPORT NotificationEventDispatcher {
static NotificationEventDispatcher* GetInstance();
using NotificationClickDispatchCompleteCallback =
// Dispatches the "notificationclick" event on the Service Worker associated
// with |persistent_notification_id| belonging to |origin|. The |callback|
// will be invoked when it's known whether the event successfully executed.
virtual void DispatchNotificationClickEvent(
BrowserContext* browser_context,
int64_t persistent_notification_id,
const GURL& origin,
const NotificationClickDispatchCompleteCallback&
dispatch_complete_callback) = 0;
virtual ~NotificationEventDispatcher() {}
} // namespace content