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" |
11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "components/browsing_data/core/browsing_data_utils.h" | 13 #include "components/browsing_data/core/browsing_data_utils.h" |
14 #include "jni/BrowsingDataCounterBridge_jni.h" | 14 #include "jni/BrowsingDataCounterBridge_jni.h" |
15 | 15 |
| 16 using base::android::JavaParamRef; |
| 17 using base::android::ScopedJavaLocalRef; |
| 18 |
16 BrowsingDataCounterBridge::BrowsingDataCounterBridge( | 19 BrowsingDataCounterBridge::BrowsingDataCounterBridge( |
17 JNIEnv* env, const JavaParamRef<jobject>& obj, jint data_type) | 20 JNIEnv* env, const JavaParamRef<jobject>& obj, jint data_type) |
18 : jobject_(obj) { | 21 : jobject_(obj) { |
19 DCHECK_GE(data_type, 0); | 22 DCHECK_GE(data_type, 0); |
20 DCHECK_LT(data_type, browsing_data::NUM_TYPES); | 23 DCHECK_LT(data_type, browsing_data::NUM_TYPES); |
21 | 24 |
22 std::string pref; | 25 std::string pref; |
23 if (!GetDeletionPreferenceFromDataType( | 26 if (!GetDeletionPreferenceFromDataType( |
24 static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) { | 27 static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) { |
25 return; | 28 return; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 env, GetCounterTextFromResult(result.get())); | 62 env, GetCounterTextFromResult(result.get())); |
60 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished( | 63 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished( |
61 env, jobject_.obj(), result_string.obj()); | 64 env, jobject_.obj(), result_string.obj()); |
62 } | 65 } |
63 | 66 |
64 static jlong Init( | 67 static jlong Init( |
65 JNIEnv* env, const JavaParamRef<jobject>& obj, int data_type) { | 68 JNIEnv* env, const JavaParamRef<jobject>& obj, int data_type) { |
66 return reinterpret_cast<intptr_t>( | 69 return reinterpret_cast<intptr_t>( |
67 new BrowsingDataCounterBridge(env, obj, data_type)); | 70 new BrowsingDataCounterBridge(env, obj, data_type)); |
68 } | 71 } |
OLD | NEW |