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

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

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 web_contents->DownloadImage(favicon_url, true, 0, false, 138 web_contents->DownloadImage(favicon_url, true, 0, false,
139 base::Bind(OnFaviconDownloaded, 139 base::Bind(OnFaviconDownloaded,
140 j_availability_callback, 140 j_availability_callback,
141 profile, page_url)); 141 profile, page_url));
142 } 142 }
143 143
144 } // namespace 144 } // namespace
145 145
146 static jlong Init(JNIEnv* env, jclass clazz) { 146 static jlong Init(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
147 return reinterpret_cast<intptr_t>(new FaviconHelper()); 147 return reinterpret_cast<intptr_t>(new FaviconHelper());
148 } 148 }
149 149
150 FaviconHelper::FaviconHelper() { 150 FaviconHelper::FaviconHelper() {
151 cancelable_task_tracker_.reset(new base::CancelableTaskTracker()); 151 cancelable_task_tracker_.reset(new base::CancelableTaskTracker());
152 } 152 }
153 153
154 void FaviconHelper::Destroy(JNIEnv* env, jobject obj) { 154 void FaviconHelper::Destroy(JNIEnv* env, jobject obj) {
155 delete this; 155 delete this;
156 } 156 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 profile, web_contents, page_url, favicon_url); 287 profile, web_contents, page_url, favicon_url);
288 favicon::FaviconService* service = FaviconServiceFactory::GetForProfile( 288 favicon::FaviconService* service = FaviconServiceFactory::GetForProfile(
289 profile, ServiceAccessType::IMPLICIT_ACCESS); 289 profile, ServiceAccessType::IMPLICIT_ACCESS);
290 service->GetFaviconImageForPageURL(page_url, callback_runner, 290 service->GetFaviconImageForPageURL(page_url, callback_runner,
291 cancelable_task_tracker_.get()); 291 cancelable_task_tracker_.get());
292 } 292 }
293 293
294 FaviconHelper::~FaviconHelper() {} 294 FaviconHelper::~FaviconHelper() {}
295 295
296 static jint GetDominantColorForBitmap(JNIEnv* env, 296 static jint GetDominantColorForBitmap(JNIEnv* env,
297 jclass clazz, 297 const JavaParamRef<jclass>& clazz,
298 jobject bitmap) { 298 const JavaParamRef<jobject>& bitmap) {
299 if (!bitmap) 299 if (!bitmap)
300 return 0; 300 return 0;
301 301
302 gfx::JavaBitmap bitmap_lock(bitmap); 302 gfx::JavaBitmap bitmap_lock(bitmap);
303 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(bitmap_lock); 303 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(bitmap_lock);
304 return color_utils::CalculateKMeanColorOfBitmap(skbitmap); 304 return color_utils::CalculateKMeanColorOfBitmap(skbitmap);
305 } 305 }
306 306
307 // static 307 // static
308 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) { 308 bool FaviconHelper::RegisterFaviconHelper(JNIEnv* env) {
309 return RegisterNativesImpl(env); 309 return RegisterNativesImpl(env);
310 } 310 }
OLDNEW
« no previous file with comments | « chrome/browser/android/download/chrome_download_delegate.cc ('k') | chrome/browser/android/feature_utilities.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698