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" | |
msramek
2016/08/11 09:12:45
As discussed offline: This #include will have to s
ioanap
2016/08/11 11:19:58
Thank you for catching this!
| |
10 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
12 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
13 #include "components/browsing_data/core/browsing_data_utils.h" | 12 #include "components/browsing_data/core/browsing_data_utils.h" |
14 #include "jni/BrowsingDataCounterBridge_jni.h" | 13 #include "jni/BrowsingDataCounterBridge_jni.h" |
15 | 14 |
16 using base::android::JavaParamRef; | 15 using base::android::JavaParamRef; |
17 using base::android::ScopedJavaLocalRef; | 16 using base::android::ScopedJavaLocalRef; |
18 | 17 |
19 BrowsingDataCounterBridge::BrowsingDataCounterBridge( | 18 BrowsingDataCounterBridge::BrowsingDataCounterBridge( |
20 JNIEnv* env, const JavaParamRef<jobject>& obj, jint data_type) | 19 JNIEnv* env, const JavaParamRef<jobject>& obj, jint data_type) |
21 : jobject_(obj) { | 20 : jobject_(obj) { |
22 DCHECK_GE(data_type, 0); | 21 DCHECK_GE(data_type, 0); |
23 DCHECK_LT(data_type, browsing_data::NUM_TYPES); | 22 DCHECK_LT(data_type, browsing_data::NUM_TYPES); |
24 | 23 |
25 std::string pref; | 24 std::string pref; |
26 if (!GetDeletionPreferenceFromDataType( | 25 if (!browsing_data::GetDeletionPreferenceFromDataType( |
27 static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) { | 26 static_cast<browsing_data::BrowsingDataType>(data_type), &pref)) { |
28 return; | 27 return; |
29 } | 28 } |
30 | 29 |
31 Profile* profile = | 30 Profile* profile = |
32 ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); | 31 ProfileManager::GetActiveUserProfile()->GetOriginalProfile(); |
33 counter_ = BrowsingDataCounterFactory::GetForProfileAndPref(profile, pref); | 32 counter_ = BrowsingDataCounterFactory::GetForProfileAndPref(profile, pref); |
34 | 33 |
35 if (!counter_) | 34 if (!counter_) |
36 return; | 35 return; |
(...skipping 25 matching lines...) Expand all Loading... | |
62 env, GetCounterTextFromResult(result.get())); | 61 env, GetCounterTextFromResult(result.get())); |
63 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished( | 62 Java_BrowsingDataCounterBridge_onBrowsingDataCounterFinished( |
64 env, jobject_.obj(), result_string.obj()); | 63 env, jobject_.obj(), result_string.obj()); |
65 } | 64 } |
66 | 65 |
67 static jlong Init( | 66 static jlong Init( |
68 JNIEnv* env, const JavaParamRef<jobject>& obj, int data_type) { | 67 JNIEnv* env, const JavaParamRef<jobject>& obj, int data_type) { |
69 return reinterpret_cast<intptr_t>( | 68 return reinterpret_cast<intptr_t>( |
70 new BrowsingDataCounterBridge(env, obj, data_type)); | 69 new BrowsingDataCounterBridge(env, obj, data_type)); |
71 } | 70 } |
OLD | NEW |