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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_linux.cc

Issue 2856753002: Linux native notifications: Add server capabilities metrics (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_platform_bridge_linux.cc
diff --git a/chrome/browser/notifications/notification_platform_bridge_linux.cc b/chrome/browser/notifications/notification_platform_bridge_linux.cc
index cf71db8869d0a8a1c7c5f89085a7fd8338243d6c..080a2f6162bc0de87ab5c8911771071c0d4051bf 100644
--- a/chrome/browser/notifications/notification_platform_bridge_linux.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_linux.cc
@@ -8,6 +8,7 @@
#include "base/barrier_closure.h"
#include "base/files/file_util.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/nullable_string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -278,11 +279,55 @@ class NotificationPlatformBridgeLinuxImpl
notification_proxy_ =
bus_->GetObjectProxy(kFreedesktopNotificationsName,
dbus::ObjectPath(kFreedesktopNotificationsPath));
+ UMA_HISTOGRAM_BOOLEAN("org.Freedesktop.Notifications",
+ !!notification_proxy_);
Mark P 2017/05/01 22:07:01 drive-by nit: I find "!!" hard to read.
Tom (Use chromium acct) 2017/05/01 22:35:01 Done.
if (!notification_proxy_) {
OnConnectionInitializationFinishedOnTaskRunner(false);
return;
}
+ dbus::MethodCall get_capabilities_call(kFreedesktopNotificationsName,
+ "GetCapabilities");
+ std::unique_ptr<dbus::Response> capabilities_response =
+ notification_proxy_->CallMethodAndBlock(
+ &get_capabilities_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT);
+ if (capabilities_response) {
+ dbus::MessageReader reader(capabilities_response.get());
+ std::vector<std::string> capabilities;
+ reader.PopArrayOfStrings(&capabilities);
+ for (const std::string& capability : capabilities)
+ capabilities_.insert(capability);
+ }
+ // Histogram macros must be called with the same name for each
+ // callsite, so we can't roll the below into a nice loop.
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.action-icons",
+ capabilities_.count("action-icons"));
+ UMA_HISTOGRAM_BOOLEAN("org.Freedesktop.Notifications.Capabilities.actions",
+ capabilities_.count("actions"));
+ UMA_HISTOGRAM_BOOLEAN("org.Freedesktop.Notifications.Capabilities.body",
+ capabilities_.count("body"));
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.body-hyperlinks",
+ capabilities_.count("body-hyperlinks"));
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.body-images",
+ capabilities_.count("body-images"));
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.body-markup",
+ capabilities_.count("body-markup"));
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.icon-multi",
+ capabilities_.count("icon-multi"));
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.icon-static",
+ capabilities_.count("icon-static"));
+ UMA_HISTOGRAM_BOOLEAN(
+ "org.Freedesktop.Notifications.Capabilities.persistence",
+ capabilities_.count("persistence"));
+ UMA_HISTOGRAM_BOOLEAN("org.Freedesktop.Notifications.Capabilities.sound",
+ capabilities_.count("sound"));
+
connected_signals_barrier_ = base::BarrierClosure(
2, base::Bind(&NotificationPlatformBridgeLinuxImpl::
OnConnectionInitializationFinishedOnTaskRunner,
@@ -547,6 +592,8 @@ class NotificationPlatformBridgeLinuxImpl
// indicates the connection is ready to use.
void OnConnectionInitializationFinishedOnUiThread(bool success) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ UMA_HISTOGRAM_BOOLEAN("Linux.NativeNotifications.UsingNativeNotifications",
+ success);
connected_ = success;
for (auto& callback : on_connected_callbacks_)
std::move(callback).Run(success);
@@ -595,6 +642,8 @@ class NotificationPlatformBridgeLinuxImpl
dbus::ObjectProxy* notification_proxy_ = nullptr;
+ std::unordered_set<std::string> capabilities_;
+
base::Closure connected_signals_barrier_;
// A std::set<std::unique_ptr<T>> doesn't work well because
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698