| 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/notification_operation_common.h" |
| 9 #include "chrome/browser/notifications/platform_notification_service_impl.h" | 10 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 10 #include "content/public/common/persistent_notification_status.h" | 11 #include "content/public/common/persistent_notification_status.h" |
| 11 | 12 |
| 12 PersistentNotificationDelegate::PersistentNotificationDelegate( | 13 PersistentNotificationDelegate::PersistentNotificationDelegate( |
| 13 content::BrowserContext* browser_context, | 14 content::BrowserContext* browser_context, |
| 14 int64_t persistent_notification_id, | 15 int64_t persistent_notification_id, |
| 15 const GURL& origin, | 16 const GURL& origin, |
| 16 int notification_settings_index) | 17 int notification_settings_index) |
| 17 : browser_context_(browser_context), | 18 : browser_context_(browser_context), |
| 18 persistent_notification_id_(persistent_notification_id), | 19 persistent_notification_id_(persistent_notification_id), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( | 37 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( |
| 37 browser_context_, | 38 browser_context_, |
| 38 persistent_notification_id_, | 39 persistent_notification_id_, |
| 39 origin_, | 40 origin_, |
| 40 -1 /* action_index */); | 41 -1 /* action_index */); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void PersistentNotificationDelegate::ButtonClick(int button_index) { | 44 void PersistentNotificationDelegate::ButtonClick(int button_index) { |
| 44 DCHECK_GE(button_index, 0); | 45 DCHECK_GE(button_index, 0); |
| 45 if (button_index == notification_settings_index_) { | 46 if (button_index == notification_settings_index_) { |
| 46 PlatformNotificationServiceImpl::GetInstance()->OpenNotificationSettings( | 47 notification_operation_common::OpenNotificationSettings(browser_context_); |
| 47 browser_context_); | |
| 48 return; | 48 return; |
| 49 } | 49 } |
| 50 | 50 |
| 51 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( | 51 PlatformNotificationServiceImpl::GetInstance()->OnPersistentNotificationClick( |
| 52 browser_context_, | 52 browser_context_, |
| 53 persistent_notification_id_, | 53 persistent_notification_id_, |
| 54 origin_, | 54 origin_, |
| 55 button_index); | 55 button_index); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void PersistentNotificationDelegate::SettingsClick() { | 58 void PersistentNotificationDelegate::SettingsClick() { |
| 59 PlatformNotificationServiceImpl::GetInstance()->OpenNotificationSettings( | 59 notification_operation_common::OpenNotificationSettings(browser_context_); |
| 60 browser_context_); | |
| 61 return; | 60 return; |
| 62 } | 61 } |
| 63 | 62 |
| 64 bool PersistentNotificationDelegate::ShouldDisplaySettingsButton() { | 63 bool PersistentNotificationDelegate::ShouldDisplaySettingsButton() { |
| 65 return true; | 64 return true; |
| 66 } | 65 } |
| 67 | 66 |
| 68 std::string PersistentNotificationDelegate::id() const { | 67 std::string PersistentNotificationDelegate::id() const { |
| 69 return id_; | 68 return id_; |
| 70 } | 69 } |
| OLD | NEW |