Commit 94272c98 authored by Piotr Bialecki's avatar Piotr Bialecki Committed by Commit Bot

Adjust strings for AR mode entry

Bug: https://crbug.com/1054042
Change-Id: I5b3009997f76ec79f9ffc6abb1ba669f3f010ce9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063671
Commit-Queue: Piotr Bialecki <bialpio@chromium.org>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742779}
parent c9f06c79
...@@ -17,6 +17,9 @@ import org.chromium.chrome.R; ...@@ -17,6 +17,9 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabImpl; import org.chromium.chrome.browser.tab.TabImpl;
import org.chromium.components.url_formatter.SchemeDisplay;
import org.chromium.components.url_formatter.UrlFormatter;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.PermissionCallback; import org.chromium.ui.base.PermissionCallback;
import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.modaldialog.DialogDismissalCause; import org.chromium.ui.modaldialog.DialogDismissalCause;
...@@ -47,11 +50,17 @@ public class ArConsentDialog implements ModalDialogProperties.Controller { ...@@ -47,11 +50,17 @@ public class ArConsentDialog implements ModalDialogProperties.Controller {
private ModalDialogManager mModalDialogManager; private ModalDialogManager mModalDialogManager;
private long mNativeArConsentDialog; private long mNativeArConsentDialog;
private WindowAndroid mWindowAndroid; private WindowAndroid mWindowAndroid;
// URL of the page entering AR.
private String mUrl;
@CalledByNative @CalledByNative
private static ArConsentDialog showDialog(long instance, @NonNull final Tab tab) { private static ArConsentDialog showDialog(long instance, @NonNull final Tab tab) {
ArConsentDialog dialog = new ArConsentDialog(instance); WebContents webContents = tab.getWebContents();
String url = webContents.getLastCommittedUrl();
ArConsentDialog dialog = new ArConsentDialog(instance, url);
dialog.show(((TabImpl) tab).getActivity()); dialog.show(((TabImpl) tab).getActivity());
return dialog; return dialog;
} }
...@@ -61,17 +70,21 @@ public class ArConsentDialog implements ModalDialogProperties.Controller { ...@@ -61,17 +70,21 @@ public class ArConsentDialog implements ModalDialogProperties.Controller {
mModalDialogManager.dismissAllDialogs(DialogDismissalCause.UNKNOWN); mModalDialogManager.dismissAllDialogs(DialogDismissalCause.UNKNOWN);
} }
private ArConsentDialog(long arConsentDialog) { private ArConsentDialog(long arConsentDialog, String url) {
mNativeArConsentDialog = arConsentDialog; mNativeArConsentDialog = arConsentDialog;
mUrl = url;
} }
public void show(ChromeActivity activity) { public void show(ChromeActivity activity) {
mWindowAndroid = activity.getWindowAndroid(); mWindowAndroid = activity.getWindowAndroid();
Resources resources = activity.getResources(); Resources resources = activity.getResources();
String dialogTitle = resources.getString(R.string.ar_immersive_mode_consent_title,
UrlFormatter.formatUrlForSecurityDisplay(mUrl, SchemeDisplay.OMIT_HTTP_AND_HTTPS));
PropertyModel model = new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) PropertyModel model = new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS)
.with(ModalDialogProperties.CONTROLLER, this) .with(ModalDialogProperties.CONTROLLER, this)
.with(ModalDialogProperties.TITLE, resources, .with(ModalDialogProperties.TITLE, dialogTitle)
R.string.ar_immersive_mode_consent_title)
.with(ModalDialogProperties.MESSAGE, resources, .with(ModalDialogProperties.MESSAGE, resources,
R.string.ar_immersive_mode_consent_message) R.string.ar_immersive_mode_consent_message)
.with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources, .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources,
......
...@@ -3598,14 +3598,14 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p ...@@ -3598,14 +3598,14 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
Augmented Reality Augmented Reality
</message> </message>
<message name="IDS_AR_IMMERSIVE_MODE_CONSENT_TITLE" desc="Title for dialog shown when a site requests consent for starting an augmented reality session."> <message name="IDS_AR_IMMERSIVE_MODE_CONSENT_TITLE" desc="Title for dialog shown when a site requests consent for starting an augmented reality session.">
Start Augmented Reality session? Enter AR from <ph name="DOMAIN">%s<ex>example.com</ex></ph>?
</message> </message>
<message name="IDS_AR_IMMERSIVE_MODE_CONSENT_MESSAGE" desc="Message for dialog shown when a site requests consent for starting an augmented reality session."> <message name="IDS_AR_IMMERSIVE_MODE_CONSENT_MESSAGE" desc="Message for dialog shown when a site requests consent for starting an augmented reality session.">
For the duration of this session, the site will be able to: While you're in AR, this site may be able to:
• create a 3D map of your environment • create a 3D map of your environment
• track camera motion • track camera motion
The site does NOT gain access to the camera. The camera images are only visible to you. Only you can see what your camera is looking at. The site can't see your camera's images.
</message> </message>
<message name="IDS_AR_IMMERSIVE_MODE_CONSENT_BUTTON" desc="Confirm button for dialog shown when a site requests consent for starting an augmented reality session."> <message name="IDS_AR_IMMERSIVE_MODE_CONSENT_BUTTON" desc="Confirm button for dialog shown when a site requests consent for starting an augmented reality session.">
Enter AR Enter AR
......
e74fa94d9cdb44a1e0fd6775706a1ec6027c7bae 45a159c60efc8bf926c8e89787ff9212bfffb83c
\ No newline at end of file \ No newline at end of file
e74fa94d9cdb44a1e0fd6775706a1ec6027c7bae caf897ed2839d89787145a0acb75b02b117e9d66
\ No newline at end of file \ No newline at end of file
e74fa94d9cdb44a1e0fd6775706a1ec6027c7bae 2f474dc661b55506e97299a4c4012b56f59aa6a8
\ No newline at end of file \ No newline at end of file
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