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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PhysicalWebPreferenceFragment.java

Issue 2108983002: Use ContextUtils in PhysicalWeb (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update tests to use new methods Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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.preferences.privacy; 5 package org.chromium.chrome.browser.preferences.privacy;
6 6
7 import android.Manifest; 7 import android.Manifest;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.Intent; 9 import android.content.Intent;
10 import android.content.pm.PackageManager; 10 import android.content.pm.PackageManager;
11 import android.os.Build; 11 import android.os.Build;
12 import android.os.Bundle; 12 import android.os.Bundle;
13 import android.preference.Preference; 13 import android.preference.Preference;
14 import android.preference.Preference.OnPreferenceChangeListener; 14 import android.preference.Preference.OnPreferenceChangeListener;
15 import android.preference.Preference.OnPreferenceClickListener; 15 import android.preference.Preference.OnPreferenceClickListener;
16 import android.preference.PreferenceFragment; 16 import android.preference.PreferenceFragment;
17 17
18 import org.chromium.base.Log; 18 import org.chromium.base.Log;
19 import org.chromium.chrome.R; 19 import org.chromium.chrome.R;
20 import org.chromium.chrome.browser.ChromeApplication;
21 import org.chromium.chrome.browser.physicalweb.ListUrlsActivity; 20 import org.chromium.chrome.browser.physicalweb.ListUrlsActivity;
22 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; 21 import org.chromium.chrome.browser.physicalweb.PhysicalWeb;
23 import org.chromium.chrome.browser.physicalweb.PhysicalWebUma; 22 import org.chromium.chrome.browser.physicalweb.PhysicalWebUma;
24 import org.chromium.chrome.browser.preferences.ButtonPreference; 23 import org.chromium.chrome.browser.preferences.ButtonPreference;
25 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference; 24 import org.chromium.chrome.browser.preferences.ChromeSwitchPreference;
26 25
27 /** 26 /**
28 * Fragment to manage the Physical Web preference and to explain to the user wha t it does. 27 * Fragment to manage the Physical Web preference and to explain to the user wha t it does.
29 */ 28 */
30 public class PhysicalWebPreferenceFragment extends PreferenceFragment { 29 public class PhysicalWebPreferenceFragment extends PreferenceFragment {
(...skipping 27 matching lines...) Expand all
58 57
59 @Override 58 @Override
60 public void onRequestPermissionsResult(int requestCode, String permissions[] , 59 public void onRequestPermissionsResult(int requestCode, String permissions[] ,
61 int[] grantResults) { 60 int[] grantResults) {
62 switch (requestCode) { 61 switch (requestCode) {
63 case REQUEST_ID: 62 case REQUEST_ID:
64 if (grantResults.length > 0 63 if (grantResults.length > 0
65 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 64 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
66 PhysicalWebUma.onPrefsLocationGranted(getActivity()); 65 PhysicalWebUma.onPrefsLocationGranted(getActivity());
67 Log.d(TAG, "Location permission granted"); 66 Log.d(TAG, "Location permission granted");
68 PhysicalWeb.startPhysicalWeb( 67 PhysicalWeb.startPhysicalWeb();
69 (ChromeApplication) getActivity().getApplicationCont ext());
70 } else { 68 } else {
71 PhysicalWebUma.onPrefsLocationDenied(getActivity()); 69 PhysicalWebUma.onPrefsLocationDenied(getActivity());
72 Log.d(TAG, "Location permission denied"); 70 Log.d(TAG, "Location permission denied");
73 } 71 }
74 break; 72 break;
75 default: 73 default:
76 } 74 }
77 } 75 }
78 76
79 private void initPhysicalWebSwitch() { 77 private void initPhysicalWebSwitch() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 109 }
112 }); 110 });
113 } 111 }
114 112
115 private static Intent createListUrlsIntent(Context context) { 113 private static Intent createListUrlsIntent(Context context) {
116 Intent intent = new Intent(context, ListUrlsActivity.class); 114 Intent intent = new Intent(context, ListUrlsActivity.class);
117 intent.putExtra(ListUrlsActivity.REFERER_KEY, ListUrlsActivity.PREFERENC E_REFERER); 115 intent.putExtra(ListUrlsActivity.REFERER_KEY, ListUrlsActivity.PREFERENC E_REFERER);
118 return intent; 116 return intent;
119 } 117 }
120 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698