| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h" | 5 #include "chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 j_callback_ptr->Reset(env, j_callback); | 108 j_callback_ptr->Reset(env, j_callback); |
| 109 bookmark_image_service_->SalientImageForUrl( | 109 bookmark_image_service_->SalientImageForUrl( |
| 110 url, base::Bind(&Callback, j_callback_ptr.release())); | 110 url, base::Bind(&Callback, j_callback_ptr.release())); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void EnhancedBookmarksBridge::FetchImageForTab(JNIEnv* env, | 113 void EnhancedBookmarksBridge::FetchImageForTab(JNIEnv* env, |
| 114 jobject obj, | 114 jobject obj, |
| 115 jobject j_web_contents) { | 115 jobject j_web_contents) { |
| 116 WebContents* web_contents = WebContents::FromJavaWebContents(j_web_contents); | 116 WebContents* web_contents = WebContents::FromJavaWebContents(j_web_contents); |
| 117 bookmark_image_service_->RetrieveSalientImageFromContext( | 117 bookmark_image_service_->RetrieveSalientImageFromContext( |
| 118 web_contents->GetMainFrame(), web_contents->GetURL(), true); | 118 web_contents, web_contents->GetURL(), true); |
| 119 } | 119 } |
| 120 | 120 |
| 121 ScopedJavaLocalRef<jstring> EnhancedBookmarksBridge::GetBookmarkDescription( | 121 ScopedJavaLocalRef<jstring> EnhancedBookmarksBridge::GetBookmarkDescription( |
| 122 JNIEnv* env, jobject obj, jlong id, jint type) { | 122 JNIEnv* env, jobject obj, jlong id, jint type) { |
| 123 DCHECK(enhanced_bookmark_model_->loaded()); | 123 DCHECK(enhanced_bookmark_model_->loaded()); |
| 124 if (type != BookmarkType::BOOKMARK_TYPE_NORMAL) { | 124 if (type != BookmarkType::BOOKMARK_TYPE_NORMAL) { |
| 125 return base::android::ConvertUTF8ToJavaString(env, std::string()); | 125 return base::android::ConvertUTF8ToJavaString(env, std::string()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID( | 128 const BookmarkNode* node = bookmarks::GetBookmarkNodeByID( |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 return reinterpret_cast<jlong>(new EnhancedBookmarksBridge( | 317 return reinterpret_cast<jlong>(new EnhancedBookmarksBridge( |
| 318 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); | 318 env, obj, ProfileAndroid::FromProfileAndroid(j_profile))); |
| 319 } | 319 } |
| 320 | 320 |
| 321 bool RegisterEnhancedBookmarksBridge(JNIEnv* env) { | 321 bool RegisterEnhancedBookmarksBridge(JNIEnv* env) { |
| 322 return RegisterNativesImpl(env); | 322 return RegisterNativesImpl(env); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace android | 325 } // namespace android |
| 326 } // namespace enhanced_bookmarks | 326 } // namespace enhanced_bookmarks |
| OLD | NEW |