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

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, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "PlatformNotificationService.PersistentNotificationDataDeleted", success);
Peter Beverloo 2015/05/22 13:40:34 These need to be added to tools/metrics/histograms
Deepak 2015/05/22 14:09:29 Done.
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_BOOLEAN(
63 // events for persistent Web Notifications. 64 "PlatformNotificationService.PersistentWebNotificationComplete",
Peter Beverloo 2015/05/22 13:40:34 Why wouldn't we record all states of |status| here
Peter Beverloo 2015/05/22 13:40:35 naming nit: PNS.PersistentWebNotificationClickResu
Deepak 2015/05/22 14:09:29 Done.
65 content::PersistentNotificationStatus::
66 PERSISTENT_NOTIFICATION_STATUS_SUCCESS == status);
Peter Beverloo 2015/05/22 13:40:35 nit: indentation.
Deepak 2015/05/22 14:09:29 ok, I will run 'git cl format' for checking indent
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698