Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java

Issue 978653002: Upstream FirstRunActivity and friends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits + remove MobileFreFinishState as it is no longer relevant Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
new file mode 100644
index 0000000000000000000000000000000000000000..368d6a5a5a684bf93425fc7231fad22b0a142ace
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
@@ -0,0 +1,91 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.firstrun;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.text.method.LinkMovementMethod;
+import android.text.style.ClickableSpan;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+import org.chromium.base.ApiCompatibilityUtils;
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.preferences.PrefServiceBridge;
+import org.chromium.ui.text.SpanApplier;
+import org.chromium.ui.text.SpanApplier.SpanInfo;
+
+/**
+ * The First Run Experience fragment that allows the user to accept Terms of Service ("ToS") and
+ * Privacy Notice, and to opt-in to the usage statistics and crash reports collection ("UMA",
+ * User Metrics Analysis) as defined in the Chrome Privacy Notice.
+ */
+public class ToSAndUMAFirstRunFragment extends FirstRunPage {
+ private Button mAcceptButton;
+ private CheckBox mSendReportCheckBox;
+ private TextView mTosAndPrivacy;
+
+ @Override
+ public View onCreateView(
+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+ return inflater.inflate(R.layout.fre_tosanduma, container, false);
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+
+ mAcceptButton = (Button) view.findViewById(R.id.terms_accept);
+ mSendReportCheckBox = (CheckBox) view.findViewById(R.id.send_report_checkbox);
+ mTosAndPrivacy = (TextView) view.findViewById(R.id.tos_and_privacy);
+
+ mAcceptButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getPageDelegate().acceptTermsOfService(mSendReportCheckBox.isChecked());
+ }
+ });
+
+ int paddingStart = getResources().getDimensionPixelSize(R.dimen.fre_tos_checkbox_padding);
+ ApiCompatibilityUtils.setPaddingRelative(mSendReportCheckBox,
+ ApiCompatibilityUtils.getPaddingStart(mSendReportCheckBox) + paddingStart,
+ mSendReportCheckBox.getPaddingTop(),
+ ApiCompatibilityUtils.getPaddingEnd(mSendReportCheckBox),
+ mSendReportCheckBox.getPaddingBottom());
+
+ mSendReportCheckBox.setChecked(!getPageDelegate().isNeverUploadCrashDump());
+
+ mTosAndPrivacy.setMovementMethod(LinkMovementMethod.getInstance());
+
+ ClickableSpan clickableTermsSpan = new ClickableSpan() {
+ @Override
+ public void onClick(View widget) {
+ getPageDelegate().showEmbedContentViewActivity(R.string.terms_of_service_title,
+ R.string.chrome_terms_of_service_url);
+ }
+ };
+
+ ClickableSpan clickablePrivacySpan = new ClickableSpan() {
+ @Override
+ public void onClick(View widget) {
+ getPageDelegate().showEmbedContentViewActivity(R.string.privacy_notice_title,
+ R.string.chrome_privacy_notice_url);
+ }
+ };
+ mTosAndPrivacy.setText(SpanApplier.applySpans(getString(R.string.fre_tos_and_privacy),
+ new SpanInfo("<LINK1>", "</LINK1>", clickableTermsSpan),
+ new SpanInfo("<LINK2>", "</LINK2>", clickablePrivacySpan)));
+ }
+
+ @Override
+ public boolean shouldSkipPageOnResume(Context appContext) {
+ return PrefServiceBridge.getInstance().isFirstRunEulaAccepted();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698