| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/engagement/site_engagement_service_android.h" | 5 #include "chrome/browser/engagement/site_engagement_service_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/profiles/profile_android.h" | 10 #include "chrome/browser/profiles/profile_android.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 JNIEnv* env, | 50 JNIEnv* env, |
| 51 const JavaParamRef<jobject>& caller, | 51 const JavaParamRef<jobject>& caller, |
| 52 const JavaParamRef<jstring>& jurl) const { | 52 const JavaParamRef<jstring>& jurl) const { |
| 53 if (!jurl) | 53 if (!jurl) |
| 54 return 0; | 54 return 0; |
| 55 | 55 |
| 56 return service_->GetScore( | 56 return service_->GetScore( |
| 57 GURL(base::android::ConvertJavaStringToUTF16(env, jurl))); | 57 GURL(base::android::ConvertJavaStringToUTF16(env, jurl))); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SiteEngagementServiceAndroid::ResetScoreForURL( | 60 void SiteEngagementServiceAndroid::ResetBaseScoreForURL( |
| 61 JNIEnv* env, | 61 JNIEnv* env, |
| 62 const JavaParamRef<jobject>& caller, | 62 const JavaParamRef<jobject>& caller, |
| 63 const JavaParamRef<jstring>& jurl, | 63 const JavaParamRef<jstring>& jurl, |
| 64 double score) { | 64 double score) { |
| 65 if (jurl) { | 65 if (jurl) { |
| 66 service_->ResetScoreForURL( | 66 service_->ResetBaseScoreForURL( |
| 67 GURL(base::android::ConvertJavaStringToUTF16(env, jurl)), score); | 67 GURL(base::android::ConvertJavaStringToUTF16(env, jurl)), score); |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 base::android::ScopedJavaLocalRef<jobject> SiteEngagementServiceForProfile( | 71 base::android::ScopedJavaLocalRef<jobject> SiteEngagementServiceForProfile( |
| 72 JNIEnv* env, | 72 JNIEnv* env, |
| 73 const JavaParamRef<jclass>& clazz, | 73 const JavaParamRef<jclass>& clazz, |
| 74 const JavaParamRef<jobject>& jprofile) { | 74 const JavaParamRef<jobject>& jprofile) { |
| 75 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); | 75 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
| 76 SiteEngagementService* service = SiteEngagementService::Get(profile); | 76 SiteEngagementService* service = SiteEngagementService::Get(profile); |
| 77 DCHECK(service); | 77 DCHECK(service); |
| 78 | 78 |
| 79 return base::android::ScopedJavaLocalRef<jobject>( | 79 return base::android::ScopedJavaLocalRef<jobject>( |
| 80 SiteEngagementServiceAndroid::GetOrCreate(env, service)); | 80 SiteEngagementServiceAndroid::GetOrCreate(env, service)); |
| 81 } | 81 } |
| OLD | NEW |