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

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

Issue 2790673002: Remove finch flag for play installation. (Closed)
Patch Set: Remove finch flag for play installation. Created 3 years, 8 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/chrome_webapk_host.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.os.StrictMode; 8 import android.os.StrictMode;
9 import android.provider.Settings; 9 import android.provider.Settings;
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 // Updating a WebAPK without going through Google Play requires "install ation from unknown 52 // Updating a WebAPK without going through Google Play requires "install ation from unknown
53 // sources" to be enabled. It is confusing for a user to see a dialog as king them to enable 53 // sources" to be enabled. It is confusing for a user to see a dialog as king them to enable
54 // "installation from unknown sources" when they are in the middle of us ing the WebAPK (as 54 // "installation from unknown sources" when they are in the middle of us ing the WebAPK (as
55 // opposed to after requesting to add a WebAPK to the homescreen). 55 // opposed to after requesting to add a WebAPK to the homescreen).
56 return installingFromUnknownSourcesAllowed() || canUseGooglePlayToInstal lWebApk(); 56 return installingFromUnknownSourcesAllowed() || canUseGooglePlayToInstal lWebApk();
57 } 57 }
58 58
59 /** Computes the GooglePlayInstallState. */ 59 /** Computes the GooglePlayInstallState. */
60 private static int computeGooglePlayInstallState() { 60 private static int computeGooglePlayInstallState() {
61 if (!isGooglePlayInstallEnabledByChromeFeature()) {
62 return GooglePlayInstallState.DISABLED_BY_VARIATIONS;
63 }
64
65 if (!ExternalAuthUtils.getInstance().canUseGooglePlayServices( 61 if (!ExternalAuthUtils.getInstance().canUseGooglePlayServices(
66 ContextUtils.getApplicationContext(), 62 ContextUtils.getApplicationContext(),
67 new UserRecoverableErrorHandler.Silent())) { 63 new UserRecoverableErrorHandler.Silent())) {
68 return GooglePlayInstallState.NO_PLAY_SERVICES; 64 return GooglePlayInstallState.NO_PLAY_SERVICES;
69 } 65 }
70 66
71 GooglePlayWebApkInstallDelegate delegate = 67 GooglePlayWebApkInstallDelegate delegate =
72 AppHooks.get().getGooglePlayWebApkInstallDelegate(); 68 AppHooks.get().getGooglePlayWebApkInstallDelegate();
73 if (delegate == null) { 69 if (delegate == null) {
74 return GooglePlayInstallState.DISABLED_OTHER; 70 return GooglePlayInstallState.DISABLED_OTHER;
75 } 71 }
76 72
77 return GooglePlayInstallState.SUPPORTED; 73 return GooglePlayInstallState.SUPPORTED;
78 } 74 }
79 75
80 /** 76 /**
81 * Returns whether installing WebAPKs from Google Play is possible. 77 * Returns whether installing WebAPKs from Google Play is possible.
82 * If {@link sCanUseGooglePlayInstall} hasn't been set yet, it returns false immediately and 78 * If {@link sCanUseGooglePlayInstall} hasn't been set yet, it returns false immediately and
83 * calls the Google Play Install API to update {@link sCanUseGooglePlayInsta ll} asynchronously. 79 * calls the Google Play Install API to update {@link sCanUseGooglePlayInsta ll} asynchronously.
84 */ 80 */
85 private static boolean canUseGooglePlayToInstallWebApk() { 81 private static boolean canUseGooglePlayToInstallWebApk() {
86 return getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED; 82 return getGooglePlayInstallState() == GooglePlayInstallState.SUPPORTED;
87 } 83 }
88 84
89 /** 85 /**
90 * Returns whether Google Play install is enabled by Chrome. Does not check whether installing
91 * from Google Play is possible.
92 */
93 public static boolean isGooglePlayInstallEnabledByChromeFeature() {
94 return isEnabled() && LibraryLoader.isInitialized()
95 && nativeCanUseGooglePlayToInstallWebApk();
96 }
97
98 /**
99 * Returns whether installing WebAPKs is possible either from "unknown resou rces" or Google 86 * Returns whether installing WebAPKs is possible either from "unknown resou rces" or Google
100 * Play. 87 * Play.
101 */ 88 */
102 @CalledByNative 89 @CalledByNative
103 private static boolean canInstallWebApk() { 90 private static boolean canInstallWebApk() {
104 return isEnabled() 91 return isEnabled()
105 && (canUseGooglePlayToInstallWebApk() || nativeCanInstallFromUnk nownSources()); 92 && (canUseGooglePlayToInstallWebApk() || nativeCanInstallFromUnk nownSources());
106 } 93 }
107 94
108 @CalledByNative 95 @CalledByNative
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 Context applicationContext = ContextUtils.getApplicationContext(); 144 Context applicationContext = ContextUtils.getApplicationContext();
158 try { 145 try {
159 return Settings.Secure.getInt(applicationContext.getContentResolver( ), 146 return Settings.Secure.getInt(applicationContext.getContentResolver( ),
160 Settings.Secure.INSTALL_NON_MARKET_APPS) 147 Settings.Secure.INSTALL_NON_MARKET_APPS)
161 == 1; 148 == 1;
162 } catch (Settings.SettingNotFoundException e) { 149 } catch (Settings.SettingNotFoundException e) {
163 return false; 150 return false;
164 } 151 }
165 } 152 }
166 153
167 private static native boolean nativeCanUseGooglePlayToInstallWebApk();
168 private static native boolean nativeCanLaunchRendererInWebApkProcess(); 154 private static native boolean nativeCanLaunchRendererInWebApkProcess();
169 private static native boolean nativeCanInstallFromUnknownSources(); 155 private static native boolean nativeCanInstallFromUnknownSources();
170 } 156 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/webapk/chrome_webapk_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698