| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 scoped_refptr<TopSites> top_sites, | 105 scoped_refptr<TopSites> top_sites, |
| 106 ScopedJavaGlobalRef<jobject>* j_callback_ref) { | 106 ScopedJavaGlobalRef<jobject>* j_callback_ref) { |
| 107 JNIEnv* env = AttachCurrentThread(); | 107 JNIEnv* env = AttachCurrentThread(); |
| 108 | 108 |
| 109 ScopedJavaGlobalRef<jobject>* j_bitmap_ref = | 109 ScopedJavaGlobalRef<jobject>* j_bitmap_ref = |
| 110 new ScopedJavaGlobalRef<jobject>(); | 110 new ScopedJavaGlobalRef<jobject>(); |
| 111 | 111 |
| 112 GURL gurl(url_string); | 112 GURL gurl(url_string); |
| 113 | 113 |
| 114 scoped_refptr<base::RefCountedMemory> data; | 114 scoped_refptr<base::RefCountedMemory> data; |
| 115 if (top_sites->GetPageThumbnail(gurl, &data)) { | 115 if (top_sites->GetPageThumbnail(gurl, false, &data)) { |
| 116 SkBitmap thumbnail_bitmap = ExtractThumbnail(*data.get()); | 116 SkBitmap thumbnail_bitmap = ExtractThumbnail(*data.get()); |
| 117 if (!thumbnail_bitmap.empty()) { | 117 if (!thumbnail_bitmap.empty()) { |
| 118 j_bitmap_ref->Reset( | 118 j_bitmap_ref->Reset( |
| 119 env, | 119 env, |
| 120 gfx::ConvertToJavaBitmap(&thumbnail_bitmap).obj()); | 120 gfx::ConvertToJavaBitmap(&thumbnail_bitmap).obj()); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Since j_callback_ref is owned by this callback, | 124 // Since j_callback_ref is owned by this callback, |
| 125 // when the callback falls out of scope it will be deleted. | 125 // when the callback falls out of scope it will be deleted. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 if (!profile) | 191 if (!profile) |
| 192 return; | 192 return; |
| 193 | 193 |
| 194 TopSites* top_sites = profile->GetTopSites(); | 194 TopSites* top_sites = profile->GetTopSites(); |
| 195 if (!top_sites) | 195 if (!top_sites) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 std::string url_string = ConvertJavaStringToUTF8(env, j_url); | 198 std::string url_string = ConvertJavaStringToUTF8(env, j_url); |
| 199 top_sites->AddBlacklistedURL(GURL(url_string)); | 199 top_sites->AddBlacklistedURL(GURL(url_string)); |
| 200 } | 200 } |
| OLD | NEW |