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; | 16 using base::android::JavaParamRef; |
17 using base::android::ScopedJavaLocalRef; | 17 using base::android::ScopedJavaLocalRef; |
18 | 18 |
19 BrowsingDataCounterBridge::BrowsingDataCounterBridge( | 19 BrowsingDataCounterBridge::BrowsingDataCounterBridge( |
20 JNIEnv* env, const JavaParamRef<jobject>& obj, jint data_type) | 20 JNIEnv* env, const JavaParamRef<jobject>& obj, jint data_type) |
21 : jobject_(obj) { | 21 : jobject_(obj) { |
22 DCHECK_GE(data_type, 0); | 22 DCHECK_GE(data_type, 0); |
23 DCHECK_LT(data_type, browsing_data::NUM_TYPES); | 23 DCHECK_LT(data_type, browsing_data::NUM_TYPES); |
24 | 24 |
25 std::string pref; | 25 std::string pref; |
26 if (!GetDeletionPreferenceFromDataType( | 26 if (!browsing_data::GetDeletionPreferenceFromDataType( |
27 static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) { | 27 static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) { |
28 return; | 28 return; |
29 } | 29 } |
30 | 30 |
31 Profile* profile = | 31 Profile* profile = |
32 ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); | 32 ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); |
33 counter_ = BrowsingDataCounterFactory::GetForProfileAndPref(profile, pref); | 33 counter_ = BrowsingDataCounterFactory::GetForProfileAndPref(profile, pref); |
34 | 34 |
35 if (!counter_) | 35 if (!counter_) |
36 return; | 36 return; |
(...skipping 25 matching lines...) Expand all Loading... |
62 env, GetChromeCounterTextFromResult(result.get())); | 62 env, GetChromeCounterTextFromResult(result.get())); |
63 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished(env, jobject_, | 63 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished(env, jobject_, |
64 result_string); | 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 |