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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 Java_ShortcutHelper_storeWebappSplashImage(env, java_webapp_id, | 230 Java_ShortcutHelper_storeWebappSplashImage(env, java_webapp_id, |
231 java_splash_image); | 231 java_splash_image); |
232 } | 232 } |
233 | 233 |
234 // static | 234 // static |
235 SkBitmap ShortcutHelper::FinalizeLauncherIconInBackground( | 235 SkBitmap ShortcutHelper::FinalizeLauncherIconInBackground( |
236 const SkBitmap& bitmap, | 236 const SkBitmap& bitmap, |
237 const GURL& url, | 237 const GURL& url, |
238 bool* is_generated) { | 238 bool* is_generated) { |
239 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 239 base::ThreadRestrictions::AssertIOAllowed(); |
240 | 240 |
241 JNIEnv* env = base::android::AttachCurrentThread(); | 241 JNIEnv* env = base::android::AttachCurrentThread(); |
242 ScopedJavaLocalRef<jobject> result; | 242 ScopedJavaLocalRef<jobject> result; |
243 *is_generated = false; | 243 *is_generated = false; |
244 | 244 |
245 if (!bitmap.isNull()) { | 245 if (!bitmap.isNull()) { |
246 if (Java_ShortcutHelper_isIconLargeEnoughForLauncher(env, bitmap.width(), | 246 if (Java_ShortcutHelper_isIconLargeEnoughForLauncher(env, bitmap.width(), |
247 bitmap.height())) { | 247 bitmap.height())) { |
248 ScopedJavaLocalRef<jobject> java_bitmap = | 248 ScopedJavaLocalRef<jobject> java_bitmap = |
249 gfx::ConvertToJavaBitmap(&bitmap); | 249 gfx::ConvertToJavaBitmap(&bitmap); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 409 |
410 ShortcutHelper::WebApkInfoCallback* webapk_list_callback = | 410 ShortcutHelper::WebApkInfoCallback* webapk_list_callback = |
411 reinterpret_cast<ShortcutHelper::WebApkInfoCallback*>(jcallback_pointer); | 411 reinterpret_cast<ShortcutHelper::WebApkInfoCallback*>(jcallback_pointer); |
412 webapk_list_callback->Run(webapk_list); | 412 webapk_list_callback->Run(webapk_list); |
413 delete webapk_list_callback; | 413 delete webapk_list_callback; |
414 } | 414 } |
415 | 415 |
416 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { | 416 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { |
417 return RegisterNativesImpl(env); | 417 return RegisterNativesImpl(env); |
418 } | 418 } |
OLD | NEW |