OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/uma_utils.h" | 5 #include "chrome/browser/android/metrics/uma_utils.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/metrics/metrics_reporting_state.h" | 10 #include "components/metrics/metrics_reporting_default_state.h" |
11 #include "jni/UmaUtils_jni.h" | 11 #include "jni/UmaUtils_jni.h" |
12 | 12 |
13 class PrefService; | 13 class PrefService; |
14 | 14 |
15 namespace chrome { | 15 namespace chrome { |
16 namespace android { | 16 namespace android { |
17 | 17 |
18 base::Time GetMainEntryPointTime() { | 18 base::Time GetMainEntryPointTime() { |
19 JNIEnv* env = base::android::AttachCurrentThread(); | 19 JNIEnv* env = base::android::AttachCurrentThread(); |
20 int64_t startTimeUnixMs = Java_UmaUtils_getMainEntryPointWallTime(env); | 20 int64_t startTimeUnixMs = Java_UmaUtils_getMainEntryPointWallTime(env); |
21 return base::Time::UnixEpoch() + | 21 return base::Time::UnixEpoch() + |
22 base::TimeDelta::FromMilliseconds(startTimeUnixMs); | 22 base::TimeDelta::FromMilliseconds(startTimeUnixMs); |
23 } | 23 } |
24 | 24 |
25 static void RecordMetricsReportingDefaultOptIn(JNIEnv* env, | 25 static void RecordMetricsReportingDefaultOptIn(JNIEnv* env, |
26 const JavaParamRef<jclass>& obj, | 26 const JavaParamRef<jclass>& obj, |
27 jboolean opt_in) { | 27 jboolean opt_in) { |
28 DCHECK(g_browser_process); | 28 DCHECK(g_browser_process); |
29 PrefService* local_state = g_browser_process->local_state(); | 29 PrefService* local_state = g_browser_process->local_state(); |
30 ::RecordMetricsReportingDefaultOptIn(local_state, opt_in); | 30 metrics::RecordMetricsReportingDefaultOptIn(local_state, opt_in); |
31 } | 31 } |
32 | 32 |
33 bool RegisterStartupMetricUtils(JNIEnv* env) { | 33 bool RegisterStartupMetricUtils(JNIEnv* env) { |
34 return RegisterNativesImpl(env); | 34 return RegisterNativesImpl(env); |
35 } | 35 } |
36 | 36 |
37 } // namespace android | 37 } // namespace android |
38 } // namespace chrome | 38 } // namespace chrome |
OLD | NEW |