| 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/shortcut_helper.h" | 5 #include "chrome/browser/android/shortcut_helper.h" |
| 6 | 6 |
| 7 #include <jni.h> | 7 #include <jni.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 ScopedJavaLocalRef<jobject> java_splash_image = | 229 ScopedJavaLocalRef<jobject> java_splash_image = |
| 230 gfx::ConvertToJavaBitmap(&splash_image); | 230 gfx::ConvertToJavaBitmap(&splash_image); |
| 231 | 231 |
| 232 Java_ShortcutHelper_storeWebappSplashImage( | 232 Java_ShortcutHelper_storeWebappSplashImage( |
| 233 env, | 233 env, |
| 234 java_webapp_id.obj(), | 234 java_webapp_id.obj(), |
| 235 java_splash_image.obj()); | 235 java_splash_image.obj()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 // static | 238 // static |
| 239 SkBitmap ShortcutHelper::FinalizeLauncherIcon(const SkBitmap& bitmap, | 239 SkBitmap ShortcutHelper::FinalizeLauncherIconInBackground( |
| 240 const GURL& url, | 240 const SkBitmap& bitmap, |
| 241 bool* is_generated) { | 241 const GURL& url, |
| 242 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 242 bool* is_generated) { |
| 243 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 243 | 244 |
| 244 JNIEnv* env = base::android::AttachCurrentThread(); | 245 JNIEnv* env = base::android::AttachCurrentThread(); |
| 245 ScopedJavaLocalRef<jobject> result; | 246 ScopedJavaLocalRef<jobject> result; |
| 246 *is_generated = false; | 247 *is_generated = false; |
| 247 | 248 |
| 248 if (!bitmap.isNull()) { | 249 if (!bitmap.isNull()) { |
| 249 if (Java_ShortcutHelper_isIconLargeEnoughForLauncher(env, bitmap.width(), | 250 if (Java_ShortcutHelper_isIconLargeEnoughForLauncher(env, bitmap.width(), |
| 250 bitmap.height())) { | 251 bitmap.height())) { |
| 251 ScopedJavaLocalRef<jobject> java_bitmap = | 252 ScopedJavaLocalRef<jobject> java_bitmap = |
| 252 gfx::ConvertToJavaBitmap(&bitmap); | 253 gfx::ConvertToJavaBitmap(&bitmap); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 DCHECK(jsplash_image_callback); | 297 DCHECK(jsplash_image_callback); |
| 297 base::Closure* splash_image_callback = | 298 base::Closure* splash_image_callback = |
| 298 reinterpret_cast<base::Closure*>(jsplash_image_callback); | 299 reinterpret_cast<base::Closure*>(jsplash_image_callback); |
| 299 splash_image_callback->Run(); | 300 splash_image_callback->Run(); |
| 300 delete splash_image_callback; | 301 delete splash_image_callback; |
| 301 } | 302 } |
| 302 | 303 |
| 303 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { | 304 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { |
| 304 return RegisterNativesImpl(env); | 305 return RegisterNativesImpl(env); |
| 305 } | 306 } |
| OLD | NEW |