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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java

Issue 2634173002: Fall back to legacy add to homescreen behavior on non-GMS device or GMS isn't availabe. (Closed)
Patch Set: Nits. Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/android/webapk/webapk_installer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 package org.chromium.chrome.browser.webapps; 5 package org.chromium.chrome.browser.webapps;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.Intent; 8 import android.content.Intent;
9 import android.content.pm.PackageManager; 9 import android.content.pm.PackageManager;
10 import android.net.Uri; 10 import android.net.Uri;
11 import android.os.Build; 11 import android.os.Build;
12 import android.os.Looper; 12 import android.os.Looper;
13 13
14 import org.chromium.base.ApplicationState; 14 import org.chromium.base.ApplicationState;
15 import org.chromium.base.ApplicationStatus; 15 import org.chromium.base.ApplicationStatus;
16 import org.chromium.base.Callback; 16 import org.chromium.base.Callback;
17 import org.chromium.base.ContentUriUtils; 17 import org.chromium.base.ContentUriUtils;
18 import org.chromium.base.ContextUtils; 18 import org.chromium.base.ContextUtils;
19 import org.chromium.base.annotations.CalledByNative; 19 import org.chromium.base.annotations.CalledByNative;
20 import org.chromium.chrome.browser.ChromeApplication; 20 import org.chromium.chrome.browser.ChromeApplication;
21 import org.chromium.chrome.browser.ShortcutHelper; 21 import org.chromium.chrome.browser.ShortcutHelper;
22 import org.chromium.chrome.browser.banners.InstallerDelegate; 22 import org.chromium.chrome.browser.banners.InstallerDelegate;
23 import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
24 import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
23 import org.chromium.chrome.browser.util.IntentUtils; 25 import org.chromium.chrome.browser.util.IntentUtils;
24 26
25 import java.io.File; 27 import java.io.File;
26 28
27 /** 29 /**
28 * Java counterpart to webapk_installer.h 30 * Java counterpart to webapk_installer.h
29 * Contains functionality to install / update WebAPKs. 31 * Contains functionality to install / update WebAPKs.
30 * This Java object is created by and owned by the native WebApkInstaller. 32 * This Java object is created by and owned by the native WebApkInstaller.
31 */ 33 */
32 public class WebApkInstaller { 34 public class WebApkInstaller {
(...skipping 22 matching lines...) Expand all
55 ChromeApplication application = (ChromeApplication) ContextUtils.getAppl icationContext(); 57 ChromeApplication application = (ChromeApplication) ContextUtils.getAppl icationContext();
56 mGooglePlayWebApkInstallDelegate = application.getGooglePlayWebApkInstal lDelegate(); 58 mGooglePlayWebApkInstallDelegate = application.getGooglePlayWebApkInstal lDelegate();
57 } 59 }
58 60
59 @CalledByNative 61 @CalledByNative
60 private static WebApkInstaller create(long nativePtr) { 62 private static WebApkInstaller create(long nativePtr) {
61 return new WebApkInstaller(nativePtr); 63 return new WebApkInstaller(nativePtr);
62 } 64 }
63 65
64 @CalledByNative 66 @CalledByNative
65 private boolean hasGooglePlayWebApkInstallDelegate() { 67 private boolean canUseGooglePlayInstallService() {
66 return mGooglePlayWebApkInstallDelegate != null; 68 return mGooglePlayWebApkInstallDelegate != null
69 && ExternalAuthUtils.getInstance().canUseGooglePlayServices(
70 ContextUtils.getApplicationContext(),
71 new UserRecoverableErrorHandler.Silent());
67 } 72 }
68 73
69 @CalledByNative 74 @CalledByNative
70 private void destroy() { 75 private void destroy() {
71 if (mListener != null) { 76 if (mListener != null) {
72 ApplicationStatus.unregisterApplicationStateListener(mListener); 77 ApplicationStatus.unregisterApplicationStateListener(mListener);
73 } 78 }
74 mListener = null; 79 mListener = null;
75 mNativePointer = 0; 80 mNativePointer = 0;
76 } 81 }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 }; 233 };
229 } 234 }
230 235
231 private boolean isWebApkInstalled(String packageName) { 236 private boolean isWebApkInstalled(String packageName) {
232 PackageManager packageManager = ContextUtils.getApplicationContext().get PackageManager(); 237 PackageManager packageManager = ContextUtils.getApplicationContext().get PackageManager();
233 return InstallerDelegate.isInstalled(packageManager, packageName); 238 return InstallerDelegate.isInstalled(packageManager, packageName);
234 } 239 }
235 240
236 private native void nativeOnInstallFinished(long nativeWebApkInstaller, bool ean success); 241 private native void nativeOnInstallFinished(long nativeWebApkInstaller, bool ean success);
237 } 242 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/webapk/webapk_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698