| 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/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 using content::BrowserContext; | 46 using content::BrowserContext; |
| 47 using content::BrowserThread; | 47 using content::BrowserThread; |
| 48 using content::PlatformNotificationContext; | 48 using content::PlatformNotificationContext; |
| 49 using message_center::NotifierId; | 49 using message_center::NotifierId; |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 // Callback to provide when deleting the data associated with persistent Web | 53 // Callback to provide when deleting the data associated with persistent Web |
| 54 // Notifications from the notification database. | 54 // Notifications from the notification database. |
| 55 void OnPersistentNotificationDataDeleted(bool success) { | 55 void OnPersistentNotificationDataDeleted(bool success) { |
| 56 UMA_HISTOGRAM_BOOLEAN( | 56 UMA_HISTOGRAM_BOOLEAN("Notifications.PersistentNotificationDataDeleted", |
| 57 "ServiceWorker.PlatformNotificationService." | 57 success); |
| 58 "PersistentNotificationDataDeleted", success); | |
| 59 } | 58 } |
| 60 | 59 |
| 61 // Persistent notifications fired through the delegate do not care about the | 60 // Persistent notifications fired through the delegate do not care about the |
| 62 // lifetime of the Service Worker responsible for executing the event. | 61 // lifetime of the Service Worker responsible for executing the event. |
| 63 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { | 62 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { |
| 64 UMA_HISTOGRAM_ENUMERATION( | 63 UMA_HISTOGRAM_ENUMERATION( |
| 65 "ServiceWorker.PlatformNotificationService." | 64 "Notifications.PersistentWebNotificationClickResult", status, |
| 66 "PersistentWebNotificationClickResult", | 65 content::PersistentNotificationStatus:: |
| 67 status, content::PersistentNotificationStatus:: | |
| 68 PERSISTENT_NOTIFICATION_STATUS_MAX); | 66 PERSISTENT_NOTIFICATION_STATUS_MAX); |
| 69 } | 67 } |
| 70 | 68 |
| 71 void CancelNotification(const std::string& id, ProfileID profile_id) { | 69 void CancelNotification(const std::string& id, ProfileID profile_id) { |
| 72 PlatformNotificationServiceImpl::GetInstance() | 70 PlatformNotificationServiceImpl::GetInstance() |
| 73 ->GetNotificationUIManager()->CancelById(id, profile_id); | 71 ->GetNotificationUIManager()->CancelById(id, profile_id); |
| 74 } | 72 } |
| 75 | 73 |
| 76 } // namespace | 74 } // namespace |
| 77 | 75 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 formatted_origin.push_back(':'); | 410 formatted_origin.push_back(':'); |
| 413 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 411 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
| 414 } | 412 } |
| 415 return formatted_origin; | 413 return formatted_origin; |
| 416 } | 414 } |
| 417 | 415 |
| 418 // TODO(dewittj): Once file:// URLs are passed in to the origin | 416 // TODO(dewittj): Once file:// URLs are passed in to the origin |
| 419 // GURL here, begin returning the path as the display name. | 417 // GURL here, begin returning the path as the display name. |
| 420 return net::FormatUrl(origin, languages); | 418 return net::FormatUrl(origin, languages); |
| 421 } | 419 } |
| OLD | NEW |