| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // static | 66 // static |
| 67 void ShortcutHelper::AddToLauncherWithSkBitmap( | 67 void ShortcutHelper::AddToLauncherWithSkBitmap( |
| 68 content::BrowserContext* browser_context, | 68 content::BrowserContext* browser_context, |
| 69 const ShortcutInfo& info, | 69 const ShortcutInfo& info, |
| 70 const std::string& webapp_id, | 70 const std::string& webapp_id, |
| 71 const SkBitmap& icon_bitmap, | 71 const SkBitmap& icon_bitmap, |
| 72 const base::Closure& splash_image_callback) { | 72 const base::Closure& splash_image_callback) { |
| 73 if (info.display == blink::WebDisplayModeStandalone || | 73 if (info.display == blink::WebDisplayModeStandalone || |
| 74 info.display == blink::WebDisplayModeFullscreen) { | 74 info.display == blink::WebDisplayModeFullscreen) { |
| 75 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 75 JNIEnv* env = base::android::AttachCurrentThread(); |
| 76 switches::kEnableWebApk)) { | 76 if (Java_ShortcutHelper_areWebApksEnabled(env)) { |
| 77 InstallWebApkWithSkBitmap(browser_context, info, icon_bitmap); | 77 InstallWebApkWithSkBitmap(browser_context, info, icon_bitmap); |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 AddWebappWithSkBitmap(info, webapp_id, icon_bitmap, splash_image_callback); | 80 AddWebappWithSkBitmap(info, webapp_id, icon_bitmap, splash_image_callback); |
| 81 return; | 81 return; |
| 82 } | 82 } |
| 83 AddShortcutWithSkBitmap(info, icon_bitmap); | 83 AddShortcutWithSkBitmap(info, icon_bitmap); |
| 84 } | 84 } |
| 85 | 85 |
| 86 // static | 86 // static |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 DCHECK(jsplash_image_callback); | 287 DCHECK(jsplash_image_callback); |
| 288 base::Closure* splash_image_callback = | 288 base::Closure* splash_image_callback = |
| 289 reinterpret_cast<base::Closure*>(jsplash_image_callback); | 289 reinterpret_cast<base::Closure*>(jsplash_image_callback); |
| 290 splash_image_callback->Run(); | 290 splash_image_callback->Run(); |
| 291 delete splash_image_callback; | 291 delete splash_image_callback; |
| 292 } | 292 } |
| 293 | 293 |
| 294 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { | 294 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { |
| 295 return RegisterNativesImpl(env); | 295 return RegisterNativesImpl(env); |
| 296 } | 296 } |
| OLD | NEW |