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

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

Issue 1026853002: Integrate the notification database with the normal code path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-ConfirmShow
Patch Set: android part Created 5 years, 8 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/notifications/persistent_notification_delegate.h" 5 #include "chrome/browser/notifications/persistent_notification_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "chrome/browser/notifications/platform_notification_service_impl.h" 9 #include "content/public/browser/notification_event_dispatcher.h"
10 #include "content/public/common/persistent_notification_status.h" 10 #include "content/public/common/persistent_notification_status.h"
11 11
12 namespace { 12 namespace {
13 13
14 // Persistent notifications fired through the delegate do not care about the 14 // Persistent notifications fired through the delegate do not care about the
15 // lifetime of the Service Worker responsible for executing the event. 15 // lifetime of the Service Worker responsible for executing the event.
16 void OnEventDispatchComplete(content::PersistentNotificationStatus status) {} 16 void OnEventDispatchComplete(content::PersistentNotificationStatus status) {}
17 17
18 } // namespace 18 } // namespace
19 19
20 PersistentNotificationDelegate::PersistentNotificationDelegate( 20 PersistentNotificationDelegate::PersistentNotificationDelegate(
21 content::BrowserContext* browser_context, 21 content::BrowserContext* browser_context,
22 int64 service_worker_registration_id, 22 int64_t persistent_notification_id,
23 const GURL& origin, 23 const GURL& origin)
24 const content::PlatformNotificationData& notification_data)
25 : browser_context_(browser_context), 24 : browser_context_(browser_context),
26 service_worker_registration_id_(service_worker_registration_id), 25 persistent_notification_id_(persistent_notification_id),
27 origin_(origin), 26 origin_(origin),
28 notification_data_(notification_data),
29 id_(base::GenerateGUID()) {} 27 id_(base::GenerateGUID()) {}
30 28
31 PersistentNotificationDelegate::~PersistentNotificationDelegate() {} 29 PersistentNotificationDelegate::~PersistentNotificationDelegate() {}
32 30
33 void PersistentNotificationDelegate::Display() {} 31 void PersistentNotificationDelegate::Display() {}
34 32
35 void PersistentNotificationDelegate::Close(bool by_user) {} 33 void PersistentNotificationDelegate::Close(bool by_user) {}
36 34
37 void PersistentNotificationDelegate::Click() { 35 void PersistentNotificationDelegate::Click() {
38 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( 36 content::NotificationEventDispatcher::GetInstance()
39 browser_context_, 37 ->DispatchNotificationClickEvent(
40 service_worker_registration_id_, 38 browser_context_,
41 id_, 39 persistent_notification_id_,
42 origin_, 40 origin_,
43 notification_data_, 41 base::Bind(&OnEventDispatchComplete));
44 base::Bind(&OnEventDispatchComplete));
45 } 42 }
46 43
47 std::string PersistentNotificationDelegate::id() const { 44 std::string PersistentNotificationDelegate::id() const {
48 return id_; 45 return id_;
49 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698