| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return; | 152 return; |
| 153 | 153 |
| 154 // TopSites updates itself after a delay. To ensure up-to-date results, force | 154 // TopSites updates itself after a delay. To ensure up-to-date results, force |
| 155 // an update now. | 155 // an update now. |
| 156 top_sites->SyncWithHistory(); | 156 top_sites->SyncWithHistory(); |
| 157 | 157 |
| 158 scoped_refptr<NativeCallback> native_callback = | 158 scoped_refptr<NativeCallback> native_callback = |
| 159 new NativeCallback(j_callback_obj, static_cast<int>(num_results)); | 159 new NativeCallback(j_callback_obj, static_cast<int>(num_results)); |
| 160 top_sites->GetMostVisitedURLs( | 160 top_sites->GetMostVisitedURLs( |
| 161 base::Bind(&NativeCallback::OnMostVisitedURLsAvailable, | 161 base::Bind(&NativeCallback::OnMostVisitedURLsAvailable, |
| 162 native_callback)); | 162 native_callback), false); |
| 163 } | 163 } |
| 164 | 164 |
| 165 // May be called from any thread | 165 // May be called from any thread |
| 166 void GetURLThumbnail( | 166 void GetURLThumbnail( |
| 167 JNIEnv* env, | 167 JNIEnv* env, |
| 168 jclass clazz, | 168 jclass clazz, |
| 169 jobject j_profile, | 169 jobject j_profile, |
| 170 jstring url, | 170 jstring url, |
| 171 jobject j_callback_obj) { | 171 jobject j_callback_obj) { |
| 172 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); | 172 Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 195 if (!profile) | 195 if (!profile) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 TopSites* top_sites = profile->GetTopSites(); | 198 TopSites* top_sites = profile->GetTopSites(); |
| 199 if (!top_sites) | 199 if (!top_sites) |
| 200 return; | 200 return; |
| 201 | 201 |
| 202 std::string url_string = ConvertJavaStringToUTF8(env, j_url); | 202 std::string url_string = ConvertJavaStringToUTF8(env, j_url); |
| 203 top_sites->AddBlacklistedURL(GURL(url_string)); | 203 top_sites->AddBlacklistedURL(GURL(url_string)); |
| 204 } | 204 } |
| OLD | NEW |