Skip to content

Commit

Permalink
[vr] Call VrShellDelegate.onNewIntent with the correct activity
Browse files Browse the repository at this point in the history
Before this CL, we were using the last focused activity to create VrShellDelegate
when we got a new auto present intent. This breaks when Chrome is already
running in the background because CTA is focused after VrShellDelegate handles
the intent. As a result of this, ChromeLaucherActivity is the last focused
activity and we never ended up auto presenting. See bug for more details.

With this CL, we pass the activity into VrShellDelegate.onNewIntent and use that
to create VrShellDelegate.

BUG=733258

Review-Url: https://codereview.chromium.org/2938873004
Cr-Commit-Position: refs/heads/master@{#479768}
  • Loading branch information
ymalik authored and Commit Bot committed Jun 15, 2017
1 parent f00df07 commit a5f1895
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ public void processUrlViewIntent(String url, String referer, String headers,

// We send this intent so that we can enter WebVr presentation mode if needed. This
// call doesn't consume the intent because it also has the url that we need to load.
VrShellDelegate.onNewIntent(intent);
VrShellDelegate.onNewIntent(ChromeTabbedActivity.this, intent);

TabModel tabModel = getCurrentTabModel();
boolean fromLauncherShortcut = IntentUtils.safeGetBooleanExtra(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,13 +676,12 @@ private void onAutopresentIntent() {
/**
* This is called every time ChromeActivity gets a new intent.
*/
public static void onNewIntent(Intent intent) {
public static void onNewIntent(ChromeActivity activity, Intent intent) {
if (IntentUtils.safeGetBooleanExtra(intent, DAYDREAM_VR_EXTRA, false)
&& ChromeFeatureList.isEnabled(ChromeFeatureList.WEBVR_AUTOPRESENT)
&& activitySupportsAutopresentation(
ApplicationStatus.getLastTrackedFocusedActivity())
&& activitySupportsAutopresentation(activity)
&& IntentHandler.isIntentFromTrustedApp(intent, DAYDREAM_HOME_PACKAGE)) {
VrShellDelegate instance = getInstance();
VrShellDelegate instance = getInstance(activity);
if (instance == null) return;
instance.onAutopresentIntent();
}
Expand Down

0 comments on commit a5f1895

Please sign in to comment.