|
|
Chromium Code Reviews
DescriptionMake WebappDelegateFactory#activateContents() take in account WebAPKs
This CL adds handling for WebAPKs in WebappDelegateFactory#activateContents().
BUG=615279
Committed: https://crrev.com/3f5e4116103dafd656bc12ba9d0699a4bb1f75f3
Cr-Commit-Position: refs/heads/master@{#433294}
Patch Set 1 #Patch Set 2 : Merge branch 'master' into activate_contents #
Total comments: 5
Patch Set 3 : Merge branch 'master' into activate_contents #Patch Set 4 : Merge branch 'master' into activate_contents #Messages
Total messages: 15 (6 generated)
pkotwicz@chromium.org changed reviewers: + dfalcantara@chromium.org
Dan, can you please take a look? This CL stops sending the MAC when launching a WebAPK. This CL makes things clearer but does not change behavior (Due to how WebappInfo#setWebappIntentExtras() is implemented)
https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java (right): https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:39: // compatibility we relaunch it the hard way. Remove the newline. https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:43: if (mActivity.getWebappInfo().webApkPackageName() != null) { !TextUtils.isEmpty() https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:46: ContextUtils.getApplicationContext().startActivity(intent); Use IntentUtils.safeStartActivity() instead. Change the one below too.
Dan, can you please take another look? I think that I have addressed all of your comments https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java (right): https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:46: ContextUtils.getApplicationContext().startActivity(intent); Random question: should we remove the context parameter from IntentUtils#safeStartActivity() and always use ContextUtils#getApplicationContext()?
lgtm https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... File chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java (right): https://codereview.chromium.org/2502213002/diff/20001/chrome/android/java/src... chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:46: ContextUtils.getApplicationContext().startActivity(intent); On 2016/11/16 22:07:41, pkotwicz wrote: > Random question: should we remove the context parameter from > IntentUtils#safeStartActivity() and always use > ContextUtils#getApplicationContext()? No; sometimes you want to use an Activity context so that things plop on top of the Activity. Can't do that with the application context since that forces you to use NEW_TASK or NEW_DOCUMENT or some such.
The CQ bit was checked by pkotwicz@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for
chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:
While running git apply --index -p1;
error: patch failed:
chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:14
error:
chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java:
patch does not apply
Patch:
chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
Index:
chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
diff --git
a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
index
f2e20f6e36f2d939a7ae14aac8ce8660f807f3e9..92f8058626b6ab4a3eb343c0a5b37e149fc60104
100644
---
a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
+++
b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
@@ -14,8 +14,10 @@ import
org.chromium.chrome.browser.tab.BrowserControlsVisibilityDelegate;
import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabDelegateFactory;
import org.chromium.chrome.browser.tab.TabWebContentsDelegateAndroid;
+import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.chrome.browser.util.UrlUtilities;
import org.chromium.components.security_state.ConnectionSecurityLevel;
+import org.chromium.webapk.lib.client.WebApkNavigationClient;
/**
* A {@link TabDelegateFactory} class to be used in all {@link Tab} instances
owned by a
@@ -32,12 +34,19 @@ public class WebappDelegateFactory extends
FullScreenDelegateFactory {
@Override
public void activateContents() {
+ // Create an Intent that will be fired toward the
WebappLauncherActivity, which in turn
+ // will fire an Intent to launch the correct WebappActivity or
WebApkActivity. On L+
+ // this could probably be changed to call AppTask.moveToFront(),
but for backwards
+ // compatibility we relaunch it the hard way.
String startUrl = mActivity.getWebappInfo().uri().toString();
- // Create an Intent that will be fired toward the
WebappLauncherActivity, which in turn
- // will fire an Intent to launch the correct WebappActivity. On L+
this could probably
- // be changed to call AppTask.moveToFront(), but for backwards
compatibility we relaunch
- // it the hard way.
+ if
(!TextUtils.isEmpty(mActivity.getWebappInfo().webApkPackageName())) {
+ Intent intent =
WebApkNavigationClient.createLaunchWebApkIntent(
+ mActivity.getWebappInfo().webApkPackageName(),
startUrl);
+
IntentUtils.safeStartActivity(ContextUtils.getApplicationContext(), intent);
+ return;
+ }
+
Intent intent = new Intent();
intent.setAction(WebappLauncherActivity.ACTION_START_WEBAPP);
intent.setPackage(mActivity.getPackageName());
@@ -46,7 +55,7 @@ public class WebappDelegateFactory extends
FullScreenDelegateFactory {
intent.putExtra(
ShortcutHelper.EXTRA_MAC,
ShortcutHelper.getEncodedMac(mActivity, startUrl));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- ContextUtils.getApplicationContext().startActivity(intent);
+ IntentUtils.safeStartActivity(ContextUtils.getApplicationContext(),
intent);
}
}
The CQ bit was checked by pkotwicz@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from dfalcantara@chromium.org Link to the patchset: https://codereview.chromium.org/2502213002/#ps60001 (title: "Merge branch 'master' into activate_contents")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== Make WebappDelegateFactory#activateContents() take in account WebAPKs This CL adds handling for WebAPKs in WebappDelegateFactory#activateContents(). BUG=615279 ========== to ========== Make WebappDelegateFactory#activateContents() take in account WebAPKs This CL adds handling for WebAPKs in WebappDelegateFactory#activateContents(). BUG=615279 Committed: https://crrev.com/3f5e4116103dafd656bc12ba9d0699a4bb1f75f3 Cr-Commit-Position: refs/heads/master@{#433294} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/3f5e4116103dafd656bc12ba9d0699a4bb1f75f3 Cr-Commit-Position: refs/heads/master@{#433294} |
