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

Side by Side Diff: chrome/browser/android/metrics/launch_metrics.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/android/metrics/launch_metrics.h" 5 #include "chrome/browser/android/metrics/launch_metrics.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/android/shortcut_info.h" 10 #include "chrome/browser/android/shortcut_info.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 break; 92 break;
93 case ShortcutInfo::SOURCE_NOTIFICATION: 93 case ShortcutInfo::SOURCE_NOTIFICATION:
94 rappor_metric_source = "Launch.HomeScreenSource.Notification"; 94 rappor_metric_source = "Launch.HomeScreenSource.Notification";
95 break; 95 break;
96 case ShortcutInfo::SOURCE_UNKNOWN: 96 case ShortcutInfo::SOURCE_UNKNOWN:
97 case ShortcutInfo::SOURCE_COUNT: 97 case ShortcutInfo::SOURCE_COUNT:
98 rappor_metric_source = "Launch.HomeScreenSource.Unknown"; 98 rappor_metric_source = "Launch.HomeScreenSource.Unknown";
99 break; 99 break;
100 } 100 }
101 101
102 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreenSource", histogram_source, 102 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreenSource",
103 static_cast<ShortcutInfo::Source>(histogram_source),
103 ShortcutInfo::SOURCE_COUNT); 104 ShortcutInfo::SOURCE_COUNT);
104 105
105 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 106 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
106 rappor_metric_source, url); 107 rappor_metric_source, url);
107 108
108 int action = standalone ? HOME_SCREEN_LAUNCH_STANDALONE 109 HomeScreenLaunch action =
109 : HOME_SCREEN_LAUNCH_SHORTCUT; 110 standalone ? HOME_SCREEN_LAUNCH_STANDALONE : HOME_SCREEN_LAUNCH_SHORTCUT;
110 std::string rappor_metric_action = standalone ? "Launch.HomeScreen.Standalone" 111 std::string rappor_metric_action = standalone ? "Launch.HomeScreen.Standalone"
111 : "Launch.HomeScreen.Shortcut"; 112 : "Launch.HomeScreen.Shortcut";
112 113
113 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreen", action, 114 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreen", action,
114 HOME_SCREEN_LAUNCH_COUNT); 115 HOME_SCREEN_LAUNCH_COUNT);
115 116
116 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 117 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
117 rappor_metric_action, url); 118 rappor_metric_action, url);
118 } 119 }
119 120
120 static void RecordHomePageLaunchMetrics( 121 static void RecordHomePageLaunchMetrics(
121 JNIEnv* env, 122 JNIEnv* env,
122 const JavaParamRef<jclass>& caller, 123 const JavaParamRef<jclass>& caller,
123 jboolean show_home_button, 124 jboolean show_home_button,
124 jboolean homepage_is_ntp, 125 jboolean homepage_is_ntp,
125 const JavaParamRef<jstring>& jhomepage_url) { 126 const JavaParamRef<jstring>& jhomepage_url) {
126 GURL homepage_url(base::android::ConvertJavaStringToUTF8(env, jhomepage_url)); 127 GURL homepage_url(base::android::ConvertJavaStringToUTF8(env, jhomepage_url));
127 PrefMetricsService::RecordHomePageLaunchMetrics( 128 PrefMetricsService::RecordHomePageLaunchMetrics(
128 show_home_button, 129 show_home_button,
129 homepage_is_ntp, 130 homepage_is_ntp,
130 homepage_url); 131 homepage_url);
131 } 132 }
132 133
133 }; // namespace metrics 134 }; // namespace metrics
OLDNEW
« no previous file with comments | « base/metrics/histogram_unittest.nc ('k') | chrome/browser/captive_portal/captive_portal_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698