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

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

Issue 2259553002: Make AppBannerInfoBar install WebAPK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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/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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // static 67 // static
68 void ShortcutHelper::AddToLauncherWithSkBitmap( 68 void ShortcutHelper::AddToLauncherWithSkBitmap(
69 content::BrowserContext* browser_context, 69 content::BrowserContext* browser_context,
70 const ShortcutInfo& info, 70 const ShortcutInfo& info,
71 const std::string& webapp_id, 71 const std::string& webapp_id,
72 const SkBitmap& icon_bitmap, 72 const SkBitmap& icon_bitmap,
73 const base::Closure& splash_image_callback) { 73 const base::Closure& splash_image_callback) {
74 if (info.display == blink::WebDisplayModeStandalone || 74 if (info.display == blink::WebDisplayModeStandalone ||
75 info.display == blink::WebDisplayModeFullscreen) { 75 info.display == blink::WebDisplayModeFullscreen) {
76 if (ChromeWebApkHost::AreWebApkEnabled()) {
pkotwicz 2016/08/19 22:17:37 Doesn't this make adding-to-homescreen from the ap
77 InstallWebApkWithSkBitmap(browser_context, info, icon_bitmap);
78 return;
79 }
80 AddWebappWithSkBitmap(info, webapp_id, icon_bitmap, splash_image_callback); 76 AddWebappWithSkBitmap(info, webapp_id, icon_bitmap, splash_image_callback);
81 return; 77 return;
82 } 78 }
83 AddShortcutWithSkBitmap(info, icon_bitmap); 79 AddShortcutWithSkBitmap(info, icon_bitmap);
84 } 80 }
85 81
86 // static 82 // static
87 void ShortcutHelper::InstallWebApkWithSkBitmap( 83 void ShortcutHelper::InstallWebApkWithSkBitmap(
88 content::BrowserContext* browser_context, 84 content::BrowserContext* browser_context,
89 const ShortcutInfo& info, 85 const ShortcutInfo& info,
90 const SkBitmap& icon_bitmap) { 86 const SkBitmap& icon_bitmap,
87 const WebApkPackageNameAvailableCallback& callback) {
91 // WebApkInstaller destroys itself when it is done. 88 // WebApkInstaller destroys itself when it is done.
92 WebApkInstaller* installer = new WebApkInstaller(info, icon_bitmap); 89 WebApkInstaller* installer = new WebApkInstaller(info, icon_bitmap);
93 installer->InstallAsync(browser_context, 90 installer->InstallAsync(browser_context, callback,
94 base::Bind(&ShortcutHelper::OnBuiltWebApk)); 91 base::Bind(&ShortcutHelper::OnBuiltWebApk));
95 } 92 }
96 93
97 // static 94 // static
98 void ShortcutHelper::AddWebappWithSkBitmap( 95 void ShortcutHelper::AddWebappWithSkBitmap(
99 const ShortcutInfo& info, 96 const ShortcutInfo& info,
100 const std::string& webapp_id, 97 const std::string& webapp_id,
101 const SkBitmap& icon_bitmap, 98 const SkBitmap& icon_bitmap,
102 const base::Closure& splash_image_callback) { 99 const base::Closure& splash_image_callback) {
103 // Send the data to the Java side to create the shortcut. 100 // Send the data to the Java side to create the shortcut.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 DCHECK(jsplash_image_callback); 284 DCHECK(jsplash_image_callback);
288 base::Closure* splash_image_callback = 285 base::Closure* splash_image_callback =
289 reinterpret_cast<base::Closure*>(jsplash_image_callback); 286 reinterpret_cast<base::Closure*>(jsplash_image_callback);
290 splash_image_callback->Run(); 287 splash_image_callback->Run();
291 delete splash_image_callback; 288 delete splash_image_callback;
292 } 289 }
293 290
294 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) { 291 bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) {
295 return RegisterNativesImpl(env); 292 return RegisterNativesImpl(env);
296 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698