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

Side by Side Diff: content/browser/notifications/persistent_notification_delegate.cc

Issue 1116693002: [NOT FOR REVIEW] Significantly simplify the PlatformNotificationService //content API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/notifications/persistent_notification_delegate.h"
6
7 #include "base/bind.h"
8 #include "content/public/browser/notification_event_dispatcher.h"
9
10 namespace content {
11 namespace {
12
13 // Persistent notifications fired through the delegate do not care about the
14 // lifetime of the Service Worker responsible for executing the event.
15 void OnEventDispatchComplete(content::PersistentNotificationStatus status) {
16 // TODO(peter): Record UMA statistics about the result status of running
17 // events for persistent Web Notifications.
18 }
19
20 } // namespace
21
22 PersistentNotificationDelegate::PersistentNotificationDelegate(
23 BrowserContext* browser_context,
24 const GURL& origin,
25 int64_t persistent_notification_id)
26 : browser_context_(browser_context),
27 origin_(origin),
28 persistent_notification_id_(persistent_notification_id) {
29 }
30
31 PersistentNotificationDelegate::~PersistentNotificationDelegate() {
32 }
33
34 void PersistentNotificationDelegate::Close(bool by_user) {
35 // TODO(peter): Implement this method after the following CL lands:
36 // https://codereview.chromium.org/1071773003/
37 }
38
39 bool PersistentNotificationDelegate::HasClickedListener() {
40 return true;
41 }
42
43 void PersistentNotificationDelegate::Click() {
44 NotificationEventDispatcher::GetInstance()
45 ->DispatchNotificationClickEvent(browser_context_,
46 persistent_notification_id_,
47 origin_,
48 base::Bind(&OnEventDispatchComplete));
49 }
50
51 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698