Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / android / rappor / rappor_service_bridge.cc
blobf88b46aed802a544499c2be2b30fe2cf5fbfe08e
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
3 // found in the LICENSE file.
5 #include "chrome/browser/android/rappor/rappor_service_bridge.h"
7 #include "base/android/jni_string.h"
8 #include "chrome/browser/browser_process.h"
9 #include "components/rappor/rappor_utils.h"
10 #include "jni/RapporServiceBridge_jni.h"
11 #include "url/gurl.h"
13 namespace rappor {
15 void SampleDomainAndRegistryFromURL(JNIEnv* env,
16 const JavaParamRef<jclass>& caller,
17 const JavaParamRef<jstring>& j_metric,
18 const JavaParamRef<jstring>& j_url) {
19 // TODO(knn): UMA metrics hash the string to prevent frequent re-encoding,
20 // perhaps we should do that as well.
21 std::string metric(base::android::ConvertJavaStringToUTF8(env, j_metric));
22 GURL gurl(base::android::ConvertJavaStringToUTF8(env, j_url));
23 rappor::SampleDomainAndRegistryFromGURL(g_browser_process->rappor_service(),
24 metric, gurl);
27 bool RegisterRapporServiceBridge(JNIEnv* env) {
28 return RegisterNativesImpl(env);
31 } // namespace rappor