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( |
56 // PlatformNotificationService. | 57 "PlatformNotificationService.PersistentNotificationDataDeleted", success); |
57 } | 58 } |
58 | 59 |
59 // Persistent notifications fired through the delegate do not care about the | 60 // Persistent notifications fired through the delegate do not care about the |
60 // lifetime of the Service Worker responsible for executing the event. | 61 // lifetime of the Service Worker responsible for executing the event. |
61 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { | 62 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { |
62 // TODO(peter): Record UMA statistics about the result status of running | 63 UMA_HISTOGRAM_ENUMERATION( |
63 // events for persistent Web Notifications. | 64 "PlatformNotificationService.PersistentWebNotificationClickResult", |
| 65 status, content::PersistentNotificationStatus:: |
| 66 PERSISTENT_NOTIFICATION_STATUS_MAX); |
64 } | 67 } |
65 | 68 |
66 void CancelNotification(const std::string& id, ProfileID profile_id) { | 69 void CancelNotification(const std::string& id, ProfileID profile_id) { |
67 PlatformNotificationServiceImpl::GetInstance() | 70 PlatformNotificationServiceImpl::GetInstance() |
68 ->GetNotificationUIManager()->CancelById(id, profile_id); | 71 ->GetNotificationUIManager()->CancelById(id, profile_id); |
69 } | 72 } |
70 | 73 |
71 } // namespace | 74 } // namespace |
72 | 75 |
73 // static | 76 // static |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 formatted_origin.push_back(':'); | 410 formatted_origin.push_back(':'); |
408 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 411 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
409 } | 412 } |
410 return formatted_origin; | 413 return formatted_origin; |
411 } | 414 } |
412 | 415 |
413 // TODO(dewittj): Once file:// URLs are passed in to the origin | 416 // TODO(dewittj): Once file:// URLs are passed in to the origin |
414 // GURL here, begin returning the path as the display name. | 417 // GURL here, begin returning the path as the display name. |
415 return net::FormatUrl(origin, languages); | 418 return net::FormatUrl(origin, languages); |
416 } | 419 } |
OLD | NEW |