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

Unified Diff: chrome/browser/ui/views/network_profile_bubble.cc

Issue 10406005: Update UMA histograms as discussed with jar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved UMA macro to a function. Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/network_profile_bubble.cc
diff --git a/chrome/browser/ui/views/network_profile_bubble.cc b/chrome/browser/ui/views/network_profile_bubble.cc
index 1496c179a3e0a61e38c3fefa749e1cd3b25804e8..9e7529cb0159ed1ab0b406a55ad71f23fd6d33e5 100644
--- a/chrome/browser/ui/views/network_profile_bubble.cc
+++ b/chrome/browser/ui/views/network_profile_bubble.cc
@@ -42,6 +42,40 @@ const int kAnchorVerticalInset = 5;
const int kInset = 2;
const int kNotificationBubbleWidth = 250;
+// The name of the UMA histogram collecting our stats.
+const char kMetricNetworkedProfileCheck[] = "NetworkedProfile.Check";
+
+enum MetricNetworkedProfileCheck {
+ // Check was suppressed by command line flag.
+ METRIC_CHECK_SUPPRESSED,
+ // WTSQuerySessionInformation call failed.
+ METRIC_CHECK_FAILED,
+ // File access in profile dir failed.
+ METRIC_CHECK_IO_FAILED,
+
+ // Profile on a network share detected.
+ METRIC_PROFILE_ON_NETWORK,
+ // Profile not on a network share detected.
+ METRIC_PROFILE_NOT_ON_NETWORK,
+
+ // Check was suppressed because of remote session.
+ METRIC_REMOTE_SESSION,
+
+ // User has clicked learn more on the notification bubble.
+ METRIC_LEARN_MORE_CLICKED,
+ // User has clicked OK on the notification bubble.
+ METRIC_ACKNOWLEDGED,
+
+ METRIC_NETWORKED_PROFILE_CHECK_SIZE // Must be the last.
+};
+
+// Helper function wrapping the UMA_HISTOGRAM_ENUMERATION macro.
+void RecordUmaEvent(MetricNetworkedProfileCheck event) {
+ UMA_HISTOGRAM_ENUMERATION(kMetricNetworkedProfileCheck,
+ event,
+ METRIC_NETWORKED_PROFILE_CHECK_SIZE);
+}
+
// Implementation of BrowserList::Observer used to wait for a browser window.
class BrowserListObserver : public BrowserList::Observer {
private:
@@ -91,7 +125,7 @@ void NetworkProfileBubble::CheckNetworkProfile(const FilePath& profile_path) {
// wild often enough.
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNoNetworkProfileWarning)) {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.CheckSuppressed", 1);
+ RecordUmaEvent(METRIC_CHECK_SUPPRESSED);
return;
}
@@ -102,7 +136,7 @@ void NetworkProfileBubble::CheckNetworkProfile(const FilePath& profile_path) {
if (!WTSQuerySessionInformation(WTS_CURRENT_SERVER, WTS_CURRENT_SESSION,
WTSClientProtocolType,
&buffer, &buffer_length)) {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.CheckFailed", 1);
+ RecordUmaEvent(METRIC_CHECK_FAILED);
return;
}
@@ -121,20 +155,20 @@ void NetworkProfileBubble::CheckNetworkProfile(const FilePath& profile_path) {
if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file))
profile_on_network = true;
} else {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.CheckIOFailed", 1);
+ RecordUmaEvent(METRIC_CHECK_IO_FAILED);
}
file_util::Delete(temp_file, false);
}
if (profile_on_network) {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.ProfileOnNetwork", 1);
+ RecordUmaEvent(METRIC_PROFILE_ON_NETWORK);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&NetworkProfileBubble::NotifyNetworkProfileDetected));
} else {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.ProfileNotOnNetwork", 1);
+ RecordUmaEvent(METRIC_PROFILE_NOT_ON_NETWORK);
}
} else {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.RemoteSession", 1);
+ RecordUmaEvent(METRIC_REMOTE_SESSION);
}
WTSFreeMemory(buffer);
@@ -233,7 +267,7 @@ gfx::Rect NetworkProfileBubble::GetAnchorRect() {
}
void NetworkProfileBubble::LinkClicked(views::Link* source, int event_flags) {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.LearnMoreClicked", 1);
+ RecordUmaEvent(METRIC_LEARN_MORE_CLICKED);
Browser* browser = BrowserList::GetLastActive();
if (browser) {
WindowOpenDisposition disposition =
@@ -256,7 +290,7 @@ void NetworkProfileBubble::LinkClicked(views::Link* source, int event_flags) {
void NetworkProfileBubble::ButtonPressed(views::Button* sender,
const views::Event& event) {
- UMA_HISTOGRAM_COUNTS("NetworkedProfile.Acknowledged", 1);
+ RecordUmaEvent(METRIC_ACKNOWLEDGED);
GetWidget()->Close();
}
« 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