| OLD | NEW |
| 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/browsing_data/browsing_data_counter_bridge.h" | 5 #include "chrome/browser/android/browsing_data/browsing_data_counter_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h" | 8 #include "chrome/browser/browsing_data/browsing_data_counter_factory.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" | 9 #include "chrome/browser/browsing_data/browsing_data_counter_utils.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 bool BrowsingDataCounterBridge::Register(JNIEnv* env) { | 53 bool BrowsingDataCounterBridge::Register(JNIEnv* env) { |
| 54 return RegisterNativesImpl(env); | 54 return RegisterNativesImpl(env); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void BrowsingDataCounterBridge::onCounterFinished( | 57 void BrowsingDataCounterBridge::onCounterFinished( |
| 58 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { | 58 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result) { |
| 59 JNIEnv* env = base::android::AttachCurrentThread(); | 59 JNIEnv* env = base::android::AttachCurrentThread(); |
| 60 ScopedJavaLocalRef<jstring> result_string = | 60 ScopedJavaLocalRef<jstring> result_string = |
| 61 base::android::ConvertUTF16ToJavaString( | 61 base::android::ConvertUTF16ToJavaString( |
| 62 env, GetChromeCounterTextFromResult(result.get())); | 62 env, GetChromeCounterTextFromResult(result.get())); |
| 63 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished( | 63 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished(env, jobject_, |
| 64 env, jobject_.obj(), result_string.obj()); | 64 result_string); |
| 65 } | 65 } |
| 66 | 66 |
| 67 static jlong Init( | 67 static jlong Init( |
| 68 JNIEnv* env, const JavaParamRef<jobject>& obj, int data_type) { | 68 JNIEnv* env, const JavaParamRef<jobject>& obj, int data_type) { |
| 69 return reinterpret_cast<intptr_t>( | 69 return reinterpret_cast<intptr_t>( |
| 70 new BrowsingDataCounterBridge(env, obj, data_type)); | 70 new BrowsingDataCounterBridge(env, obj, data_type)); |
| 71 } | 71 } |
| OLD | NEW |