Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/notifications/persistent_notification_delegate.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/guid.h" | |
| 9 #include "chrome/browser/notifications/platform_notification_service_impl.h" | |
| 10 #include "content/public/common/persistent_notification_status.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 // Persistent notifications fired through the delegate do not care about the | |
| 15 // lifetime of the Service Worker responsible for executing the event. | |
| 16 void OnEventDispatchComplete(content::PersistentNotificationStatus status) {} | |
| 17 | |
| 18 } // namespace | |
| 19 | |
| 20 PersistentNotificationDelegate::PersistentNotificationDelegate( | |
| 21 content::BrowserContext* browser_context, | |
| 22 int64 service_worker_registration_id, | |
| 23 const content::ShowDesktopNotificationHostMsgParams& params) | |
| 24 : browser_context_(browser_context), | |
| 25 service_worker_registration_id_(service_worker_registration_id), | |
| 26 notification_data_(params), | |
| 27 id_(base::GenerateGUID()) {} | |
|
dewittj
2014/12/11 17:18:50
If I read this correctly, one of the use cases for
Peter Beverloo
2014/12/11 19:02:00
I'm not sure whether it makes sense to re-create a
| |
| 28 | |
| 29 PersistentNotificationDelegate::~PersistentNotificationDelegate() {} | |
| 30 | |
| 31 void PersistentNotificationDelegate::Display() {} | |
| 32 | |
| 33 void PersistentNotificationDelegate::Close(bool by_user) {} | |
| 34 | |
| 35 void PersistentNotificationDelegate::Click() { | |
| 36 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( | |
| 37 browser_context_, | |
| 38 service_worker_registration_id_, | |
| 39 id_, | |
| 40 notification_data_, | |
| 41 base::Bind(&OnEventDispatchComplete)); | |
| 42 } | |
| 43 | |
| 44 std::string PersistentNotificationDelegate::id() const { | |
| 45 return id_; | |
| 46 } | |
| OLD | NEW |