OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/android/metrics/launch_metrics.h" |
| 6 |
| 7 #include "base/android/jni_string.h" |
| 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/metrics/user_metrics.h" |
| 10 #include "chrome/browser/metrics/rappor/sampling.h" |
| 11 #include "jni/LaunchMetrics_jni.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace metrics { |
| 15 |
| 16 enum HomeScreenLaunch { |
| 17 HOME_SCREEN_LAUNCH_STANDALONE = 0, |
| 18 HOME_SCREEN_LAUNCH_SHORTCUT = 1, |
| 19 HOME_SCREEN_LAUNCH_COUNT = 2 |
| 20 }; |
| 21 |
| 22 bool RegisterLaunchMetrics(JNIEnv* env) { |
| 23 return RegisterNativesImpl(env); |
| 24 } |
| 25 |
| 26 static void RecordLaunch(JNIEnv* env, jclass caller, jboolean standalone, |
| 27 jstring jurl) { |
| 28 int action = standalone ? HOME_SCREEN_LAUNCH_STANDALONE |
| 29 : HOME_SCREEN_LAUNCH_SHORTCUT; |
| 30 std::string rappor_metric = standalone ? "Launch.HomeScreen.Standalone" |
| 31 : "Launch.HomeScreen.Shortcut"; |
| 32 |
| 33 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreen", action, |
| 34 HOME_SCREEN_LAUNCH_COUNT); |
| 35 |
| 36 std::string url = base::android::ConvertJavaStringToUTF8(env, jurl); |
| 37 rappor::SampleDomainAndRegistryFromGURL(rappor_metric, GURL(url)); |
| 38 } |
| 39 |
| 40 }; // namespace metrics |
OLD | NEW |