OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.physicalweb; | 5 package org.chromium.chrome.browser.physicalweb; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.os.Bundle; | 9 import android.os.Bundle; |
10 import android.support.v7.app.AppCompatActivity; | 10 import android.support.v7.app.AppCompatActivity; |
11 import android.view.View; | 11 import android.view.View; |
12 import android.widget.Button; | 12 import android.widget.Button; |
13 | 13 |
14 import org.chromium.chrome.R; | 14 import org.chromium.chrome.R; |
15 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager
; | 15 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager
; |
16 | 16 |
17 /** | 17 /** |
18 * This activity invites the user to opt-in to the Physical Web feature. | 18 * This activity invites the user to opt-in to the Physical Web feature. |
19 */ | 19 */ |
20 public class PhysicalWebOptInActivity extends AppCompatActivity { | 20 public class PhysicalWebOptInActivity extends AppCompatActivity { |
21 @Override | 21 @Override |
22 protected void onCreate(Bundle savedInstanceState) { | 22 protected void onCreate(Bundle savedInstanceState) { |
23 super.onCreate(savedInstanceState); | 23 super.onCreate(savedInstanceState); |
24 setContentView(R.layout.physical_web_optin); | 24 setContentView(R.layout.physical_web_optin); |
| 25 PhysicalWebUma.onOptInNotificationPressed(this); |
25 | 26 |
26 Button declineButton = (Button) findViewById(R.id.physical_web_decline); | 27 Button declineButton = (Button) findViewById(R.id.physical_web_decline); |
27 declineButton.setOnClickListener(new View.OnClickListener() { | 28 declineButton.setOnClickListener(new View.OnClickListener() { |
28 @Override | 29 @Override |
29 public void onClick(View v) { | 30 public void onClick(View v) { |
| 31 PhysicalWebUma.onOptInDeclineButtonPressed(PhysicalWebOptInActiv
ity.this); |
30 PrivacyPreferencesManager privacyPrefManager = | 32 PrivacyPreferencesManager privacyPrefManager = |
31 PrivacyPreferencesManager.getInstance(PhysicalWebOptInAc
tivity.this); | 33 PrivacyPreferencesManager.getInstance(PhysicalWebOptInAc
tivity.this); |
32 privacyPrefManager.setPhysicalWebEnabled(false); | 34 privacyPrefManager.setPhysicalWebEnabled(false); |
33 finish(); | 35 finish(); |
34 } | 36 } |
35 }); | 37 }); |
36 | 38 |
37 Button enableButton = (Button) findViewById(R.id.physical_web_enable); | 39 Button enableButton = (Button) findViewById(R.id.physical_web_enable); |
38 enableButton.setOnClickListener(new View.OnClickListener() { | 40 enableButton.setOnClickListener(new View.OnClickListener() { |
39 @Override | 41 @Override |
40 public void onClick(View v) { | 42 public void onClick(View v) { |
| 43 PhysicalWebUma.onOptInEnableButtonPressed(PhysicalWebOptInActivi
ty.this); |
41 PrivacyPreferencesManager privacyPrefManager = | 44 PrivacyPreferencesManager privacyPrefManager = |
42 PrivacyPreferencesManager.getInstance(PhysicalWebOptInAc
tivity.this); | 45 PrivacyPreferencesManager.getInstance(PhysicalWebOptInAc
tivity.this); |
43 privacyPrefManager.setPhysicalWebEnabled(true); | 46 privacyPrefManager.setPhysicalWebEnabled(true); |
44 startActivity(createListUrlsIntent(PhysicalWebOptInActivity.this
)); | 47 startActivity(createListUrlsIntent(PhysicalWebOptInActivity.this
)); |
45 finish(); | 48 finish(); |
46 } | 49 } |
47 }); | 50 }); |
48 } | 51 } |
49 | 52 |
50 private static Intent createListUrlsIntent(Context context) { | 53 private static Intent createListUrlsIntent(Context context) { |
51 Intent intent = new Intent(context, ListUrlsActivity.class); | 54 Intent intent = new Intent(context, ListUrlsActivity.class); |
52 intent.putExtra(ListUrlsActivity.REFERER_KEY, | 55 intent.putExtra(ListUrlsActivity.REFERER_KEY, |
53 ListUrlsActivity.OPTIN_REFERER); | 56 ListUrlsActivity.OPTIN_REFERER); |
54 return intent; | 57 return intent; |
55 } | 58 } |
56 } | 59 } |
OLD | NEW |