| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 jobject j_observer, | 232 jobject j_observer, |
| 233 jint num_sites) { | 233 jint num_sites) { |
| 234 observer_.Reset(env, j_observer); | 234 observer_.Reset(env, j_observer); |
| 235 num_sites_ = num_sites; | 235 num_sites_ = num_sites; |
| 236 | 236 |
| 237 if (ShouldShowPopularSites() && | 237 if (ShouldShowPopularSites() && |
| 238 NeedPopularSites(profile_->GetPrefs(), num_sites_)) { | 238 NeedPopularSites(profile_->GetPrefs(), num_sites_)) { |
| 239 popular_sites_.reset(new PopularSites( | 239 popular_sites_.reset(new PopularSites( |
| 240 profile_, | 240 profile_, |
| 241 GetPopularSitesFilename(), | 241 GetPopularSitesFilename(), |
| 242 profile_->GetRequestContext(), | |
| 243 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, | 242 base::Bind(&MostVisitedSites::OnPopularSitesAvailable, |
| 244 base::Unretained(this)))); | 243 base::Unretained(this)))); |
| 245 } else { | 244 } else { |
| 246 received_popular_sites_ = true; | 245 received_popular_sites_ = true; |
| 247 } | 246 } |
| 248 | 247 |
| 249 QueryMostVisitedURLs(); | 248 QueryMostVisitedURLs(); |
| 250 | 249 |
| 251 scoped_refptr<history::TopSites> top_sites = | 250 scoped_refptr<history::TopSites> top_sites = |
| 252 TopSitesFactory::GetForProfile(profile_); | 251 TopSitesFactory::GetForProfile(profile_); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 726 } |
| 728 } | 727 } |
| 729 | 728 |
| 730 static jlong Init(JNIEnv* env, | 729 static jlong Init(JNIEnv* env, |
| 731 const JavaParamRef<jobject>& obj, | 730 const JavaParamRef<jobject>& obj, |
| 732 const JavaParamRef<jobject>& jprofile) { | 731 const JavaParamRef<jobject>& jprofile) { |
| 733 MostVisitedSites* most_visited_sites = | 732 MostVisitedSites* most_visited_sites = |
| 734 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); | 733 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); |
| 735 return reinterpret_cast<intptr_t>(most_visited_sites); | 734 return reinterpret_cast<intptr_t>(most_visited_sites); |
| 736 } | 735 } |
| OLD | NEW |