Commit d86e751b authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

Show link to Family Link privacy policy in lightweight FRE

BUG=753386

Change-Id: I66193175816295ed064689cb74a0f6fd0287a001
Reviewed-on: https://chromium-review.googlesource.com/660721
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501430}
parent 5cc46455
......@@ -280,7 +280,8 @@ public abstract class FirstRunFlowSequencer {
if (preferLightweightFre) {
if (!FirstRunStatus.shouldSkipWelcomePage()
&& !FirstRunStatus.getLightweightFirstRunFlowComplete()) {
return createLightweightFirstRunIntent(context, fromChromeIcon);
return createFirstRunIntent(
context, LightweightFirstRunActivity.class.getName(), fromChromeIcon);
}
} else {
return createGenericFirstRunIntent(context, fromChromeIcon);
......@@ -291,21 +292,25 @@ public abstract class FirstRunFlowSequencer {
return null;
}
private static Intent createLightweightFirstRunIntent(Context context, boolean fromChromeIcon) {
Intent intent = new Intent();
intent.setClassName(context, LightweightFirstRunActivity.class.getName());
intent.putExtra(FirstRunActivity.EXTRA_COMING_FROM_CHROME_ICON, fromChromeIcon);
return intent;
}
/**
* @return A generic intent to show the First Run Activity.
* @param context The context.
* @param fromChromeIcon Whether Chrome is opened via the Chrome icon.
*/
public static Intent createGenericFirstRunIntent(Context context, boolean fromChromeIcon) {
return createFirstRunIntent(context, FirstRunActivity.class.getName(), fromChromeIcon);
}
/**
* @return An intent to show the First Run Activity.
* @param context The context.
* @param firstRunActivityClassName The class name of the first run activity to start.
* @param fromChromeIcon Whether Chrome is opened via the Chrome icon.
*/
public static Intent createFirstRunIntent(
Context context, String firstRunActivityClassName, boolean fromChromeIcon) {
Intent intent = new Intent();
intent.setClassName(context, FirstRunActivity.class.getName());
intent.setClassName(context, firstRunActivityClassName);
intent.putExtra(FirstRunActivity.EXTRA_COMING_FROM_CHROME_ICON, fromChromeIcon);
intent.putExtra(FirstRunActivity.EXTRA_USE_FRE_FLOW_SEQUENCER, true);
return intent;
......
......@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.firstrun;
import android.os.Bundle;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
......@@ -11,9 +12,7 @@ import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import org.chromium.base.CommandLine;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.ui.base.LocalizationUtils;
import org.chromium.ui.text.NoUnderlineClickableSpan;
......@@ -24,43 +23,81 @@ import org.chromium.ui.text.SpanApplier.SpanInfo;
* Lightweight FirstRunActivity. It shows ToS dialog only.
*/
public class LightweightFirstRunActivity extends FirstRunActivityBase {
private FirstRunFlowSequencer mFirstRunFlowSequencer;
private Bundle mFreProperties;
private Button mOkButton;
private boolean mNativeInitialized;
private boolean mTriggerAcceptAfterNativeInit;
@Override
public void setContentView() {
if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)) {
completeFirstRunExperience();
Bundle savedInstanceState = getSavedInstanceState();
if (savedInstanceState != null) {
mFreProperties = savedInstanceState;
} else if (getIntent() != null) {
mFreProperties = getIntent().getExtras();
} else {
mFreProperties = new Bundle();
}
setFinishOnTouchOutside(true);
mFirstRunFlowSequencer = new FirstRunFlowSequencer(this, mFreProperties) {
@Override
public void onFlowIsKnown(Bundle freProperties) {
if (freProperties == null) {
completeFirstRunExperience();
return;
}
mFreProperties = freProperties;
onChildAccountKnown(
mFreProperties.getBoolean(AccountFirstRunFragment.IS_CHILD_ACCOUNT));
}
};
mFirstRunFlowSequencer.start();
}
/** Called once it is known whether the device has a child account. */
public void onChildAccountKnown(boolean hasChildAccount) {
setContentView(LayoutInflater.from(LightweightFirstRunActivity.this)
.inflate(R.layout.lightweight_fre_tos, null));
NoUnderlineClickableSpan clickableTermsSpan = new NoUnderlineClickableSpan() {
@Override
public void onClick(View widget) {
CustomTabActivity.showInfoPage(LightweightFirstRunActivity.this,
LocalizationUtils.substituteLocalePlaceholder(
getString(R.string.chrome_terms_of_service_url)));
showInfoPage(R.string.chrome_terms_of_service_url);
}
};
NoUnderlineClickableSpan clickablePrivacySpan = new NoUnderlineClickableSpan() {
@Override
public void onClick(View widget) {
CustomTabActivity.showInfoPage(LightweightFirstRunActivity.this,
LocalizationUtils.substituteLocalePlaceholder(
getString(R.string.chrome_privacy_notice_url)));
showInfoPage(R.string.chrome_privacy_notice_url);
}
};
((TextView) findViewById(R.id.lightweight_fre_tos_and_privacy))
.setText(SpanApplier.applySpans(getString(R.string.lightweight_fre_tos_and_privacy),
NoUnderlineClickableSpan clickableFamilyLinkPrivacySpan = new NoUnderlineClickableSpan() {
@Override
public void onClick(View widget) {
showInfoPage(R.string.family_link_privacy_policy_url);
}
};
final CharSequence tosAndPrivacyText;
if (hasChildAccount) {
tosAndPrivacyText = SpanApplier.applySpans(
getString(R.string.lightweight_fre_tos_and_privacy_child_account),
new SpanInfo("<LINK1>", "</LINK1>", clickableTermsSpan),
new SpanInfo("<LINK2>", "</LINK2>", clickablePrivacySpan)));
((TextView) findViewById(R.id.lightweight_fre_tos_and_privacy))
.setMovementMethod(LinkMovementMethod.getInstance());
new SpanInfo("<LINK2>", "</LINK2>", clickablePrivacySpan),
new SpanInfo("<LINK3>", "</LINK3>", clickableFamilyLinkPrivacySpan));
} else {
tosAndPrivacyText =
SpanApplier.applySpans(getString(R.string.lightweight_fre_tos_and_privacy),
new SpanInfo("<LINK1>", "</LINK1>", clickableTermsSpan),
new SpanInfo("<LINK2>", "</LINK2>", clickablePrivacySpan));
}
TextView tosAndPrivacyTextView =
(TextView) findViewById(R.id.lightweight_fre_tos_and_privacy);
tosAndPrivacyTextView.setText(tosAndPrivacyText);
tosAndPrivacyTextView.setMovementMethod(LinkMovementMethod.getInstance());
mOkButton = (Button) findViewById(R.id.lightweight_fre_terms_accept);
mOkButton.setOnClickListener(new OnClickListener() {
......@@ -88,6 +125,12 @@ public class LightweightFirstRunActivity extends FirstRunActivityBase {
if (mTriggerAcceptAfterNativeInit) acceptTermsOfService();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putAll(mFreProperties);
}
@Override
public void onBackPressed() {
abortFirstRunExperience();
......@@ -116,4 +159,13 @@ public class LightweightFirstRunActivity extends FirstRunActivityBase {
FirstRunUtils.acceptTermsOfService(false);
completeFirstRunExperience();
}
/**
* Show an informational web page. The page doesn't show navigation control.
* @param url Resource id for the URL of the web page.
*/
public void showInfoPage(int url) {
CustomTabActivity.showInfoPage(
this, LocalizationUtils.substituteLocalePlaceholder(getString(url)));
}
}
......@@ -2224,6 +2224,9 @@ To obtain new licenses, connect to the internet and play your downloaded content
<message name="IDS_LIGHTWEIGHT_FRE_TOS_AND_PRIVACY" desc="Message explaining that use of Chrome is governed by Chrome's terms of service and privacy notice.">
By continuing, you agree to Chrome’s <ph name="BEGIN_LINK1">&lt;LINK1&gt;</ph>Terms of Service<ph name="END_LINK1">&lt;/LINK1&gt;</ph> and <ph name="BEGIN_LINK2">&lt;LINK2&gt;</ph>Privacy Notice<ph name="END_LINK2">&lt;/LINK2&gt;</ph>.
</message>
<message name="IDS_LIGHTWEIGHT_FRE_TOS_AND_PRIVACY_CHILD_ACCOUNT" desc="Message explaining that use of Chrome is governed by Chrome's terms of service and privacy notice, and Family Link's privacy notice for children.">
By continuing, you agree to Chrome's <ph name="BEGIN_LINK1">&lt;LINK1&gt;</ph>Terms of Service<ph name="END_LINK1">&lt;/LINK1&gt;</ph> and <ph name="BEGIN_LINK2">&lt;LINK2&gt;</ph>Privacy Notice<ph name="END_LINK2">&lt;/LINK2&gt;</ph>, and the <ph name="BEGIN_LINK3">&lt;LINK3&gt;</ph>Privacy Notice for Google Accounts Created in Family Link<ph name="END_LINK3">&lt;/LINK3&gt;</ph>.
</message>
<message name="IDS_FRE_SEND_REPORT_CHECK" desc="Text for asking the user to allow sending stats and crash reports">
Help make Chrome better by sending usage statistics and crash reports to Google.
</message>
......
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