Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: chrome/browser/android/favicon_helper.cc

Issue 2347173002: Extend FaviconService to support fetching favicons from a Google server (Closed)
Patch Set: Peter's comments #2 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 gfx::Image favicon_image = gfx::Image::CreateFrom1xPNGBytes(favicon_png); 143 gfx::Image favicon_image = gfx::Image::CreateFrom1xPNGBytes(favicon_png);
144 SkBitmap favicon_bitmap = favicon_image.AsBitmap(); 144 SkBitmap favicon_bitmap = favicon_image.AsBitmap();
145 145
146 ScopedJavaLocalRef<jobject> j_favicon_bitmap; 146 ScopedJavaLocalRef<jobject> j_favicon_bitmap;
147 if (favicon_bitmap.isNull()) 147 if (favicon_bitmap.isNull())
148 return ScopedJavaLocalRef<jobject>(); 148 return ScopedJavaLocalRef<jobject>();
149 149
150 return gfx::ConvertToJavaBitmap(&favicon_bitmap); 150 return gfx::ConvertToJavaBitmap(&favicon_bitmap);
151 } 151 }
152 152
153 // TODO(jkrcal): change this code to use
154 // FaviconService::Get1xFaviconForPageURLDownloadFromGoogleServerIfMissing.
153 void FaviconHelper::EnsureIconIsAvailable( 155 void FaviconHelper::EnsureIconIsAvailable(
154 JNIEnv* env, 156 JNIEnv* env,
155 const JavaParamRef<jobject>& obj, 157 const JavaParamRef<jobject>& obj,
156 const JavaParamRef<jobject>& j_profile, 158 const JavaParamRef<jobject>& j_profile,
157 const JavaParamRef<jobject>& j_web_contents, 159 const JavaParamRef<jobject>& j_web_contents,
158 const JavaParamRef<jstring>& j_page_url, 160 const JavaParamRef<jstring>& j_page_url,
159 const JavaParamRef<jstring>& j_icon_url, 161 const JavaParamRef<jstring>& j_icon_url,
160 jboolean j_is_large_icon, 162 jboolean j_is_large_icon,
161 jboolean j_is_temporary, 163 jboolean j_is_temporary,
162 const JavaParamRef<jobject>& j_availability_callback) { 164 const JavaParamRef<jobject>& j_availability_callback) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 274
273 web_contents->DownloadImage( 275 web_contents->DownloadImage(
274 icon_url, true, 0, false, 276 icon_url, true, 0, false,
275 base::Bind(OnFaviconDownloaded, j_availability_callback, profile, 277 base::Bind(OnFaviconDownloaded, j_availability_callback, profile,
276 page_url, icon_type, is_temporary)); 278 page_url, icon_type, is_temporary));
277 } 279 }
278 280
279 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { 281 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) {
280 return RegisterNativesImpl(env); 282 return RegisterNativesImpl(env);
281 } 283 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/favicon/favicon_service_factory.cc » ('j') | components/favicon/core/favicon_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698