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

Side by Side Diff: chrome/browser/android/rappor/rappor_service_bridge.cc

Issue 1352693002: Add a rappor metric for getting package names for custom tabs clients (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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/rappor/rappor_service_bridge.h" 5 #include "chrome/browser/android/rappor/rappor_service_bridge.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "components/rappor/rappor_utils.h" 9 #include "components/rappor/rappor_utils.h"
10 #include "jni/RapporServiceBridge_jni.h" 10 #include "jni/RapporServiceBridge_jni.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace rappor { 13 namespace rappor {
14 14
15 void SampleDomainAndRegistryFromURL(JNIEnv* env, 15 void SampleDomainAndRegistryFromURL(JNIEnv* env,
16 const JavaParamRef<jclass>& caller, 16 const JavaParamRef<jclass>& caller,
17 const JavaParamRef<jstring>& j_metric, 17 const JavaParamRef<jstring>& j_metric,
18 const JavaParamRef<jstring>& j_url) { 18 const JavaParamRef<jstring>& j_url) {
19 // TODO(knn): UMA metrics hash the string to prevent frequent re-encoding, 19 // TODO(knn): UMA metrics hash the string to prevent frequent re-encoding,
20 // perhaps we should do that as well. 20 // perhaps we should do that as well.
21 std::string metric(base::android::ConvertJavaStringToUTF8(env, j_metric)); 21 std::string metric(base::android::ConvertJavaStringToUTF8(env, j_metric));
22 GURL gurl(base::android::ConvertJavaStringToUTF8(env, j_url)); 22 GURL gurl(base::android::ConvertJavaStringToUTF8(env, j_url));
23 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(), 23 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
24 metric, gurl); 24 metric, gurl);
25 } 25 }
26 26
27 void SampleString(JNIEnv* env,
28 const JavaParamRef<jclass>& caller,
29 const JavaParamRef<jstring>& j_metric,
30 const JavaParamRef<jstring>& j_value) {
31 std::string metric(base::android::ConvertJavaStringToUTF8(env, j_metric));
32 std::string value(base::android::ConvertJavaStringToUTF8(env, j_value));
33 rappor::SampleString(g_browser_process->rappor_service(),
34 metric, rappor::UMA_RAPPOR_TYPE, value);
35 }
36
27 bool RegisterRapporServiceBridge(JNIEnv* env) { 37 bool RegisterRapporServiceBridge(JNIEnv* env) {
28 return RegisterNativesImpl(env); 38 return RegisterNativesImpl(env);
29 } 39 }
30 40
31 } // namespace rappor 41 } // namespace rappor
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/rappor/RapporServiceBridge.java ('k') | tools/metrics/rappor/rappor.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698