Update V8 to version 4.7.21.
[chromium-blink-merge.git] / chrome / browser / android / rappor / rappor_service_bridge.cc
blob7dd7293bcaf71a122987256bfe09c1f633d5bf3e
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 jclass caller,
17 jstring j_metric,
18 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