Commit a31c7538 authored by peter@chromium.org's avatar peter@chromium.org

Add the Blink APIs for the WebNotificationManager.

The WebNotificationManager is analogous to the WebNotificationPresenter
living in public/web/, but without any dependency on RenderView or
RenderFrames. It also splits up the concept of the data associated with
a notification and the delegate allowing the embedder to interact with
it, as it will soon become possible for the embedder to trigger creation
of Notification objects as well (for event delivery in Service Workers).

BUG=392187

Review URL: https://codereview.chromium.org/672183003

git-svn-id: svn://svn.chromium.org/blink/trunk@184306 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 61dd6a53
...@@ -85,7 +85,7 @@ class WebMediaStreamCenter; ...@@ -85,7 +85,7 @@ class WebMediaStreamCenter;
class WebMediaStreamCenterClient; class WebMediaStreamCenterClient;
class WebMessagePortChannel; class WebMessagePortChannel;
class WebMimeRegistry; class WebMimeRegistry;
class WebNotificationPresenter; class WebNotificationManager;
class WebPluginListBuilder; class WebPluginListBuilder;
class WebPrescientNetworking; class WebPrescientNetworking;
class WebPublicSuffixList; class WebPublicSuffixList;
...@@ -632,7 +632,7 @@ public: ...@@ -632,7 +632,7 @@ public:
// Web Notifications -------------------------------------------------- // Web Notifications --------------------------------------------------
virtual WebNotificationPresenter* notificationPresenter() { return 0; } virtual WebNotificationManager* notificationManager() { return 0; }
// Geofencing --------------------------------------------------------- // Geofencing ---------------------------------------------------------
......
// 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.
#ifndef WebNotificationData_h
#define WebNotificationData_h
#include "WebString.h"
#include "WebURL.h"
namespace blink {
// Structure representing the data associated with a Web Notification.
struct WebNotificationData {
enum Direction {
DirectionLeftToRight,
DirectionRightToLeft
};
WebNotificationData()
: direction(DirectionLeftToRight)
{
}
WebNotificationData(const WebString& title, Direction direction, const WebString& lang, const WebString& body, const WebString& tag, const WebURL& icon)
: title(title)
, direction(direction)
, lang(lang)
, body(body)
, tag(tag)
, icon(icon)
{
}
WebString title;
Direction direction;
WebString lang;
WebString body;
WebString tag;
WebURL icon;
};
} // namespace blink
#endif // WebNotificationData_h
// 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.
#ifndef WebNotificationDelegate_h
#define WebNotificationDelegate_h
namespace blink {
// A delegate through which the embedder can trigger events on a Document-bound
// Web Notifications object. Service Worker-bound Web Notifications will not have
// a delegate, as their events will be fired on a Service Worker instead.
class WebNotificationDelegate {
public:
virtual void dispatchClickEvent() = 0;
virtual void dispatchShowEvent() = 0;
virtual void dispatchErrorEvent() = 0;
virtual void dispatchCloseEvent() = 0;
};
} // namespace blink
#endif // WebNotificationDelegate_h
// 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.
#ifndef WebNotificationManager_h
#define WebNotificationManager_h
#include "WebNotificationPermission.h"
namespace blink {
struct WebNotificationData;
class WebNotificationDelegate;
class WebSerializedOrigin;
// Provides the services to show platform notifications to the user.
class WebNotificationManager {
public:
virtual ~WebNotificationManager() { }
// Shows a notification on the user's system.
virtual void show(const blink::WebSerializedOrigin&, const WebNotificationData&, WebNotificationDelegate*) = 0;
// Closes a notification previously shown, and removes it if being shown.
virtual void close(WebNotificationDelegate*) = 0;
// Indicates that the delegate object is being destroyed, and must no longer
// be used by the embedder to dispatch events.
virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0;
// Synchronously checks the permission level for the given origin.
virtual WebNotificationPermission checkPermission(const WebSerializedOrigin&) = 0;
};
} // namespace blink
#endif // WebNotificationManager_h
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment