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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 11 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
11 #include "chrome/browser/notifications/notification_object_proxy.h" | 12 #include "chrome/browser/notifications/notification_object_proxy.h" |
12 #include "chrome/browser/notifications/notification_ui_manager.h" | 13 #include "chrome/browser/notifications/notification_ui_manager.h" |
13 #include "chrome/browser/notifications/persistent_notification_delegate.h" | 14 #include "chrome/browser/notifications/persistent_notification_delegate.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_io_data.h" | 16 #include "chrome/browser/profiles/profile_io_data.h" |
16 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
45 using content::BrowserContext; | 46 using content::BrowserContext; |
46 using content::BrowserThread; | 47 using content::BrowserThread; |
47 using content::PlatformNotificationContext; | 48 using content::PlatformNotificationContext; |
48 using message_center::NotifierId; | 49 using message_center::NotifierId; |
49 | 50 |
50 namespace { | 51 namespace { |
51 | 52 |
52 // Callback to provide when deleting the data associated with persistent Web | 53 // Callback to provide when deleting the data associated with persistent Web |
53 // Notifications from the notification database. | 54 // Notifications from the notification database. |
54 void OnPersistentNotificationDataDeleted(bool success) { | 55 void OnPersistentNotificationDataDeleted(bool success) { |
55 // TODO(peter): Record UMA for notification deletion requests created by the | 56 UMA_HISTOGRAM_BOOLEAN("PNS.PersistentNotificationDataDeleted", success); |
Peter Beverloo
2015/05/22 15:35:42
Oh dear. Sorry, I typed PNS as an acronym for Plat
Deepak
2015/05/23 04:41:22
Done.
| |
56 // PlatformNotificationService. | |
57 } | 57 } |
58 | 58 |
59 // Persistent notifications fired through the delegate do not care about the | 59 // Persistent notifications fired through the delegate do not care about the |
60 // lifetime of the Service Worker responsible for executing the event. | 60 // lifetime of the Service Worker responsible for executing the event. |
61 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { | 61 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { |
62 // TODO(peter): Record UMA statistics about the result status of running | 62 UMA_HISTOGRAM_ENUMERATION( |
63 // events for persistent Web Notifications. | 63 "PNS.PersistentWebNotificationClickResult", status, |
64 content::PersistentNotificationStatus:: | |
65 PERSISTENT_NOTIFICATION_STATUS_DATABASE_ERROR + 1); | |
Peter Beverloo
2015/05/22 15:35:42
Could we add a PERSISTENT_NOTIFICATION_STATUS_MAX
Deepak
2015/05/23 04:41:22
Done.
| |
64 } | 66 } |
65 | 67 |
66 void CancelNotification(const std::string& id, ProfileID profile_id) { | 68 void CancelNotification(const std::string& id, ProfileID profile_id) { |
67 PlatformNotificationServiceImpl::GetInstance() | 69 PlatformNotificationServiceImpl::GetInstance() |
68 ->GetNotificationUIManager()->CancelById(id, profile_id); | 70 ->GetNotificationUIManager()->CancelById(id, profile_id); |
69 } | 71 } |
70 | 72 |
71 } // namespace | 73 } // namespace |
72 | 74 |
73 // static | 75 // static |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 formatted_origin.push_back(':'); | 409 formatted_origin.push_back(':'); |
408 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 410 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
409 } | 411 } |
410 return formatted_origin; | 412 return formatted_origin; |
411 } | 413 } |
412 | 414 |
413 // TODO(dewittj): Once file:// URLs are passed in to the origin | 415 // TODO(dewittj): Once file:// URLs are passed in to the origin |
414 // GURL here, begin returning the path as the display name. | 416 // GURL here, begin returning the path as the display name. |
415 return net::FormatUrl(origin, languages); | 417 return net::FormatUrl(origin, languages); |
416 } | 418 } |
OLD | NEW |