| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/provider/chrome_browser_provider.h" | 5 #include "chrome/browser/android/provider/chrome_browser_provider.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 | 1556 |
| 1557 ScopedJavaLocalRef<jbyteArray> ChromeBrowserProvider::GetThumbnail( | 1557 ScopedJavaLocalRef<jbyteArray> ChromeBrowserProvider::GetThumbnail( |
| 1558 JNIEnv* env, jobject obj, jstring jurl) { | 1558 JNIEnv* env, jobject obj, jstring jurl) { |
| 1559 if (!jurl) | 1559 if (!jurl) |
| 1560 return ScopedJavaLocalRef<jbyteArray>(); | 1560 return ScopedJavaLocalRef<jbyteArray>(); |
| 1561 GURL url = GURL(ConvertJavaStringToUTF16(env, jurl)); | 1561 GURL url = GURL(ConvertJavaStringToUTF16(env, jurl)); |
| 1562 | 1562 |
| 1563 // GetPageThumbnail is synchronous and can be called from any thread. | 1563 // GetPageThumbnail is synchronous and can be called from any thread. |
| 1564 scoped_refptr<base::RefCountedMemory> thumbnail; | 1564 scoped_refptr<base::RefCountedMemory> thumbnail; |
| 1565 if (top_sites_) | 1565 if (top_sites_) |
| 1566 top_sites_->GetPageThumbnail(url, &thumbnail); | 1566 top_sites_->GetPageThumbnail(url, false, &thumbnail); |
| 1567 | 1567 |
| 1568 if (!thumbnail.get() || !thumbnail->front()) { | 1568 if (!thumbnail.get() || !thumbnail->front()) { |
| 1569 return ScopedJavaLocalRef<jbyteArray>(); | 1569 return ScopedJavaLocalRef<jbyteArray>(); |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 return base::android::ToJavaByteArray(env, thumbnail->front(), | 1572 return base::android::ToJavaByteArray(env, thumbnail->front(), |
| 1573 thumbnail->size()); | 1573 thumbnail->size()); |
| 1574 } | 1574 } |
| 1575 | 1575 |
| 1576 // ------------- Observer-related methods ------------- // | 1576 // ------------- Observer-related methods ------------- // |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj()); | 1611 Java_ChromeBrowserProvider_onBookmarkChanged(env, obj.obj()); |
| 1612 } else if (type == | 1612 } else if (type == |
| 1613 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { | 1613 chrome::NOTIFICATION_HISTORY_KEYWORD_SEARCH_TERM_UPDATED) { |
| 1614 JNIEnv* env = AttachCurrentThread(); | 1614 JNIEnv* env = AttachCurrentThread(); |
| 1615 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); | 1615 ScopedJavaLocalRef<jobject> obj = weak_java_provider_.get(env); |
| 1616 if (obj.is_null()) | 1616 if (obj.is_null()) |
| 1617 return; | 1617 return; |
| 1618 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); | 1618 Java_ChromeBrowserProvider_onSearchTermChanged(env, obj.obj()); |
| 1619 } | 1619 } |
| 1620 } | 1620 } |
| OLD | NEW |