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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java

Issue 1526323003: Add Physical Web opt-in dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: taking changes from dfalcantara@ Created 5 years 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/physicalweb/PhysicalWebOptInActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..7f14c7d4189a7f1a61ddbabe8c78d2d65beaf77b
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebOptInActivity.java
@@ -0,0 +1,56 @@
+// 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.physicalweb;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v7.app.AppCompatActivity;
+import android.view.View;
+import android.widget.Button;
+
+import org.chromium.chrome.R;
+import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager;
+
+/**
+ * This activity invites the user to opt-in to the Physical Web feature.
+ */
+public class PhysicalWebOptInActivity extends AppCompatActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.physical_web_optin);
+
+ Button declineButton = (Button) findViewById(R.id.physical_web_decline);
+ declineButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ PrivacyPreferencesManager privacyPrefManager =
+ PrivacyPreferencesManager.getInstance(PhysicalWebOptInActivity.this);
+ privacyPrefManager.setPhysicalWebEnabled(false);
+ finish();
+ }
+ });
+
+ Button enableButton = (Button) findViewById(R.id.physical_web_enable);
+ enableButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ PrivacyPreferencesManager privacyPrefManager =
+ PrivacyPreferencesManager.getInstance(PhysicalWebOptInActivity.this);
+ privacyPrefManager.setPhysicalWebEnabled(true);
+ startActivity(createListUrlsIntent(PhysicalWebOptInActivity.this));
+ finish();
+ }
+ });
+ }
+
+ private static Intent createListUrlsIntent(Context context) {
+ Intent intent = new Intent(context, ListUrlsActivity.class);
+ intent.putExtra(ListUrlsActivity.REFERER_KEY,
+ ListUrlsActivity.OPTIN_REFERER);
+ return intent;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698