Commit 35502e8f authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[vr] Request to exit VR if user clicks 'Learn More' on incognito NTP.

- The 'Learn More' button on the incognito NTP either opens a new
  activity or a new non-icognito tab. Both is not supported in VR.
  As a workaround for now, request to exit VR and if we succeed show the
  'Learn More' page in 2D.

Bug: 742668
Change-Id: I23b9a2447ab297468dd9612c3e3e351ef59b3e40
Reviewed-on: https://chromium-review.googlesource.com/578169
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488487}
parent 2f735566
......@@ -21,6 +21,9 @@ import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareT
import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.ntp.IncognitoNewTabPageView.IncognitoNewTabPageManager;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.vr_shell.OnExitVrRequestListener;
import org.chromium.chrome.browser.vr_shell.UiUnsupportedMode;
import org.chromium.chrome.browser.vr_shell.VrShellDelegate;
/**
* Provides functionality when the user interacts with the Incognito NTP.
......@@ -39,9 +42,23 @@ public class IncognitoNewTabPage implements NativePage, InvalidationAwareThumbna
new IncognitoNewTabPageManager() {
@Override
public void loadIncognitoLearnMore() {
HelpAndFeedback.getInstance(mActivity).show(mActivity,
mActivity.getString(R.string.help_context_incognito_learn_more),
Profile.getLastUsedProfile(), null);
// Incognito 'Learn More' either opens a new activity or a new non-incognito tab.
// Both is not supported in VR. Request to exit VR and if we succeed show the 'Learn
// More' page in 2D.
if (VrShellDelegate.isInVr()) {
VrShellDelegate.requestToExitVr(new OnExitVrRequestListener() {
@Override
public void onSucceeded() {
showIncognitoLearnMore();
}
@Override
public void onDenied() {}
}, UiUnsupportedMode.UNHANDLED_CODE_POINT);
return;
}
showIncognitoLearnMore();
}
@Override
......@@ -50,6 +67,12 @@ public class IncognitoNewTabPage implements NativePage, InvalidationAwareThumbna
}
};
private void showIncognitoLearnMore() {
HelpAndFeedback.getInstance(mActivity).show(mActivity,
mActivity.getString(R.string.help_context_incognito_learn_more),
Profile.getLastUsedProfile(), null);
}
/**
* Constructs an Incognito NewTabPage.
* @param activity The activity used to create the new tab page's View.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment