| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/most_visited_sites.h" | 5 #include "chrome/browser/android/most_visited_sites.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 jobject j_observer, | 228 jobject j_observer, |
| 229 jint num_sites) { | 229 jint num_sites) { |
| 230 observer_.Reset(env, j_observer); | 230 observer_.Reset(env, j_observer); |
| 231 num_sites_ = num_sites; | 231 num_sites_ = num_sites; |
| 232 | 232 |
| 233 if (ShouldShowPopularSites() && | 233 if (ShouldShowPopularSites() && |
| 234 NeedPopularSites(profile_->GetPrefs(), num_sites_)) { | 234 NeedPopularSites(profile_->GetPrefs(), num_sites_)) { |
| 235 popular_sites_.reset(new PopularSites( | 235 popular_sites_.reset(new PopularSites( |
| 236 profile_, | 236 profile_, |
| 237 GetPopularSitesFilename(), | 237 GetPopularSitesFilename(), |
| 238 profile_->GetRequestContext(), | |
| 239 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, | 238 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, |
| 240 base::Unretained(this)))); | 239 base::Unretained(this)))); |
| 241 } else { | 240 } else { |
| 242 received_popular_sites_ = true; | 241 received_popular_sites_ = true; |
| 243 } | 242 } |
| 244 | 243 |
| 245 QueryMostVisitedURLs(); | 244 QueryMostVisitedURLs(); |
| 246 | 245 |
| 247 scoped_refptr<history::TopSites> top_sites = | 246 scoped_refptr<history::TopSites> top_sites = |
| 248 TopSitesFactory::GetForProfile(profile_); | 247 TopSitesFactory::GetForProfile(profile_); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 } | 722 } |
| 724 } | 723 } |
| 725 | 724 |
| 726 static jlong Init(JNIEnv* env, | 725 static jlong Init(JNIEnv* env, |
| 727 const JavaParamRef<jobject>& obj, | 726 const JavaParamRef<jobject>& obj, |
| 728 const JavaParamRef<jobject>& jprofile) { | 727 const JavaParamRef<jobject>& jprofile) { |
| 729 MostVisitedSites* most_visited_sites = | 728 MostVisitedSites* most_visited_sites = |
| 730 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); | 729 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); |
| 731 return reinterpret_cast<intptr_t>(most_visited_sites); | 730 return reinterpret_cast<intptr_t>(most_visited_sites); |
| 732 } | 731 } |
| OLD | NEW |