Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 1155483002: Adding UMA for persistent notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 "ServiceWorker.PlatformNotificationService."
58 "PersistentNotificationDataDeleted", success);
57 } 59 }
58 60
59 // Persistent notifications fired through the delegate do not care about the 61 // Persistent notifications fired through the delegate do not care about the
60 // lifetime of the Service Worker responsible for executing the event. 62 // lifetime of the Service Worker responsible for executing the event.
61 void OnEventDispatchComplete(content::PersistentNotificationStatus status) { 63 void OnEventDispatchComplete(content::PersistentNotificationStatus status) {
62 // TODO(peter): Record UMA statistics about the result status of running 64 UMA_HISTOGRAM_ENUMERATION(
63 // events for persistent Web Notifications. 65 "ServiceWorker.PlatformNotificationService."
66 "PersistentWebNotificationClickResult",
67 status, content::PersistentNotificationStatus::
68 PERSISTENT_NOTIFICATION_STATUS_MAX);
64 } 69 }
65 70
66 void CancelNotification(const std::string& id, ProfileID profile_id) { 71 void CancelNotification(const std::string& id, ProfileID profile_id) {
67 PlatformNotificationServiceImpl::GetInstance() 72 PlatformNotificationServiceImpl::GetInstance()
68 ->GetNotificationUIManager()->CancelById(id, profile_id); 73 ->GetNotificationUIManager()->CancelById(id, profile_id);
69 } 74 }
70 75
71 } // namespace 76 } // namespace
72 77
73 // static 78 // static
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 formatted_origin.push_back(':'); 412 formatted_origin.push_back(':');
408 formatted_origin.append(base::UTF8ToUTF16(origin.port())); 413 formatted_origin.append(base::UTF8ToUTF16(origin.port()));
409 } 414 }
410 return formatted_origin; 415 return formatted_origin;
411 } 416 }
412 417
413 // TODO(dewittj): Once file:// URLs are passed in to the origin 418 // TODO(dewittj): Once file:// URLs are passed in to the origin
414 // GURL here, begin returning the path as the display name. 419 // GURL here, begin returning the path as the display name.
415 return net::FormatUrl(origin, languages); 420 return net::FormatUrl(origin, languages);
416 } 421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698