| 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/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 : notification_ui_manager_for_tests_(nullptr) {} | 94 : notification_ui_manager_for_tests_(nullptr) {} |
| 95 | 95 |
| 96 PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {} | 96 PlatformNotificationServiceImpl::~PlatformNotificationServiceImpl() {} |
| 97 | 97 |
| 98 void PlatformNotificationServiceImpl::OnPersistentNotificationClick( | 98 void PlatformNotificationServiceImpl::OnPersistentNotificationClick( |
| 99 BrowserContext* browser_context, | 99 BrowserContext* browser_context, |
| 100 int64_t persistent_notification_id, | 100 int64_t persistent_notification_id, |
| 101 const GURL& origin, | 101 const GURL& origin, |
| 102 int action_index) const { | 102 int action_index) const { |
| 103 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 103 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 104 content::RecordAction( | 104 if (action_index == -1) { |
| 105 base::UserMetricsAction("Notifications.Persistent.Clicked")); | 105 content::RecordAction(base::UserMetricsAction( |
| 106 "Notifications.Persistent.Clicked")); |
| 107 } else { |
| 108 content::RecordAction(base::UserMetricsAction( |
| 109 "Notifications.Persistent.ClickedActionButton")); |
| 110 } |
| 106 | 111 |
| 107 content::NotificationEventDispatcher::GetInstance() | 112 content::NotificationEventDispatcher::GetInstance() |
| 108 ->DispatchNotificationClickEvent( | 113 ->DispatchNotificationClickEvent( |
| 109 browser_context, | 114 browser_context, |
| 110 persistent_notification_id, | 115 persistent_notification_id, |
| 111 origin, | 116 origin, |
| 112 action_index, | 117 action_index, |
| 113 base::Bind(&OnEventDispatchComplete)); | 118 base::Bind(&OnEventDispatchComplete)); |
| 114 } | 119 } |
| 115 | 120 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( | 439 extensions::ExtensionRegistry::Get(profile)->GetExtensionById( |
| 435 origin.host(), extensions::ExtensionRegistry::EVERYTHING); | 440 origin.host(), extensions::ExtensionRegistry::EVERYTHING); |
| 436 DCHECK(extension); | 441 DCHECK(extension); |
| 437 | 442 |
| 438 return base::UTF8ToUTF16(extension->name()); | 443 return base::UTF8ToUTF16(extension->name()); |
| 439 } | 444 } |
| 440 #endif | 445 #endif |
| 441 | 446 |
| 442 return base::string16(); | 447 return base::string16(); |
| 443 } | 448 } |
| OLD | NEW |