| 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/favicon_helper.h" | 5 #include "chrome/browser/android/favicon_helper.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ScopedJavaLocalRef<jobject> FaviconHelper::GetSyncedFaviconImageForURL( | 185 ScopedJavaLocalRef<jobject> FaviconHelper::GetSyncedFaviconImageForURL( |
| 186 JNIEnv* env, | 186 JNIEnv* env, |
| 187 const JavaParamRef<jobject>& obj, | 187 const JavaParamRef<jobject>& obj, |
| 188 const JavaParamRef<jobject>& jprofile, | 188 const JavaParamRef<jobject>& jprofile, |
| 189 const JavaParamRef<jstring>& j_page_url) { | 189 const JavaParamRef<jstring>& j_page_url) { |
| 190 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); | 190 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
| 191 DCHECK(profile); | 191 DCHECK(profile); |
| 192 | 192 |
| 193 std::string page_url = ConvertJavaStringToUTF8(env, j_page_url); | 193 std::string page_url = ConvertJavaStringToUTF8(env, j_page_url); |
| 194 | 194 |
| 195 ProfileSyncService* sync_service = | 195 browser_sync::ProfileSyncService* sync_service = |
| 196 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 196 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 197 DCHECK(sync_service); | 197 DCHECK(sync_service); |
| 198 | 198 |
| 199 scoped_refptr<base::RefCountedMemory> favicon_png; | 199 scoped_refptr<base::RefCountedMemory> favicon_png; |
| 200 sync_sessions::OpenTabsUIDelegate* open_tabs = | 200 sync_sessions::OpenTabsUIDelegate* open_tabs = |
| 201 sync_service->GetOpenTabsUIDelegate(); | 201 sync_service->GetOpenTabsUIDelegate(); |
| 202 DCHECK(open_tabs); | 202 DCHECK(open_tabs); |
| 203 | 203 |
| 204 if (!open_tabs->GetSyncedFaviconForPageURL(page_url, &favicon_png)) | 204 if (!open_tabs->GetSyncedFaviconForPageURL(page_url, &favicon_png)) |
| 205 return ScopedJavaLocalRef<jobject>(); | 205 return ScopedJavaLocalRef<jobject>(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 gfx::JavaBitmap bitmap_lock(bitmap); | 259 gfx::JavaBitmap bitmap_lock(bitmap); |
| 260 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(bitmap_lock); | 260 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(bitmap_lock); |
| 261 return color_utils::CalculateKMeanColorOfBitmap(skbitmap); | 261 return color_utils::CalculateKMeanColorOfBitmap(skbitmap); |
| 262 } | 262 } |
| 263 | 263 |
| 264 // static | 264 // static |
| 265 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { | 265 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { |
| 266 return RegisterNativesImpl(env); | 266 return RegisterNativesImpl(env); |
| 267 } | 267 } |
| OLD | NEW |