| OLD | NEW |
| 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/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "chrome/browser/android/shortcut_info.h" | 11 #include "chrome/browser/android/shortcut_info.h" |
| 12 #include "chrome/browser/banners/app_banner_settings_helper.h" | 12 #include "chrome/browser/banners/app_banner_settings_helper.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/engagement/site_engagement_service.h" | 14 #include "chrome/browser/engagement/site_engagement_service.h" |
| 15 #include "chrome/browser/prefs/pref_metrics_service.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 #include "components/rappor/rappor_utils.h" | 17 #include "components/rappor/rappor_utils.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "jni/LaunchMetrics_jni.h" | 19 #include "jni/LaunchMetrics_jni.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 namespace metrics { | 22 namespace metrics { |
| 22 | 23 |
| 23 enum HomeScreenLaunch { | 24 enum HomeScreenLaunch { |
| 24 HOME_SCREEN_LAUNCH_STANDALONE = 0, | 25 HOME_SCREEN_LAUNCH_STANDALONE = 0, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 std::string rappor_metric_action = standalone ? "Launch.HomeScreen.Standalone" | 81 std::string rappor_metric_action = standalone ? "Launch.HomeScreen.Standalone" |
| 81 : "Launch.HomeScreen.Shortcut"; | 82 : "Launch.HomeScreen.Shortcut"; |
| 82 | 83 |
| 83 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreen", action, | 84 UMA_HISTOGRAM_ENUMERATION("Launch.HomeScreen", action, |
| 84 HOME_SCREEN_LAUNCH_COUNT); | 85 HOME_SCREEN_LAUNCH_COUNT); |
| 85 | 86 |
| 86 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), | 87 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), |
| 87 rappor_metric_action, url); | 88 rappor_metric_action, url); |
| 88 } | 89 } |
| 89 | 90 |
| 91 static void RecordHomePageLaunchMetrics( |
| 92 JNIEnv* env, |
| 93 const JavaParamRef<jclass>& caller, |
| 94 jboolean show_home_button, |
| 95 jboolean homepage_is_ntp, |
| 96 const JavaParamRef<jstring>& jhomepage_url) { |
| 97 GURL homepage_url(base::android::ConvertJavaStringToUTF8(env, jhomepage_url)); |
| 98 PrefMetricsService::RecordHomePageLaunchMetrics( |
| 99 show_home_button, |
| 100 homepage_is_ntp, |
| 101 homepage_url); |
| 102 } |
| 103 |
| 90 }; // namespace metrics | 104 }; // namespace metrics |
| OLD | NEW |