| OLD | NEW |
| 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 "chrome/browser/notifications/platform_notification_service_impl.h" |
| 10 #include "content/public/common/persistent_notification_status.h" | 10 #include "content/public/common/persistent_notification_status.h" |
| 11 | 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( | 12 PersistentNotificationDelegate::PersistentNotificationDelegate( |
| 21 content::BrowserContext* browser_context, | 13 content::BrowserContext* browser_context, |
| 22 int64_t persistent_notification_id, | 14 int64_t persistent_notification_id, |
| 23 const GURL& origin) | 15 const GURL& origin) |
| 24 : browser_context_(browser_context), | 16 : browser_context_(browser_context), |
| 25 persistent_notification_id_(persistent_notification_id), | 17 persistent_notification_id_(persistent_notification_id), |
| 26 origin_(origin), | 18 origin_(origin), |
| 27 id_(base::GenerateGUID()) {} | 19 id_(base::GenerateGUID()) {} |
| 28 | 20 |
| 29 PersistentNotificationDelegate::~PersistentNotificationDelegate() {} | 21 PersistentNotificationDelegate::~PersistentNotificationDelegate() {} |
| 30 | 22 |
| 31 void PersistentNotificationDelegate::Display() {} | 23 void PersistentNotificationDelegate::Display() {} |
| 32 | 24 |
| 33 void PersistentNotificationDelegate::Close(bool by_user) {} | 25 void PersistentNotificationDelegate::Close(bool by_user) {} |
| 34 | 26 |
| 35 void PersistentNotificationDelegate::Click() { | 27 void PersistentNotificationDelegate::Click() { |
| 36 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( | 28 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( |
| 37 browser_context_, | 29 browser_context_, |
| 38 persistent_notification_id_, | 30 persistent_notification_id_, |
| 39 origin_, | 31 origin_); |
| 40 base::Bind(&OnEventDispatchComplete)); | |
| 41 } | 32 } |
| 42 | 33 |
| 43 std::string PersistentNotificationDelegate::id() const { | 34 std::string PersistentNotificationDelegate::id() const { |
| 44 return id_; | 35 return id_; |
| 45 } | 36 } |
| OLD | NEW |