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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebDiagnosticsPage.java

Issue 2105573002: Revert of Add a LocationUtils class to give all Chromium Android code access to location helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.content.res.Resources; 9 import android.content.res.Resources;
10 import android.os.Build; 10 import android.os.Build;
11 import android.text.Html; 11 import android.text.Html;
12 import android.text.util.Linkify; 12 import android.text.util.Linkify;
13 import android.view.LayoutInflater; 13 import android.view.LayoutInflater;
14 import android.view.View; 14 import android.view.View;
15 import android.widget.Button; 15 import android.widget.Button;
16 import android.widget.TextView; 16 import android.widget.TextView;
17 17
18 import org.chromium.base.ApiCompatibilityUtils; 18 import org.chromium.base.ApiCompatibilityUtils;
19 import org.chromium.chrome.R; 19 import org.chromium.chrome.R;
20 import org.chromium.chrome.browser.NativePage; 20 import org.chromium.chrome.browser.NativePage;
21 import org.chromium.chrome.browser.UrlConstants; 21 import org.chromium.chrome.browser.UrlConstants;
22 import org.chromium.components.location.LocationUtils;
23 22
24 import java.util.HashSet; 23 import java.util.HashSet;
25 import java.util.Set; 24 import java.util.Set;
26 25
27 /** 26 /**
28 * Provides diagnostic information about the Physical Web feature. 27 * Provides diagnostic information about the Physical Web feature.
29 */ 28 */
30 public class PhysicalWebDiagnosticsPage implements NativePage { 29 public class PhysicalWebDiagnosticsPage implements NativePage {
31 private final Context mContext; 30 private final Context mContext;
32 private final int mBackgroundColor; 31 private final int mBackgroundColor;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 return; 93 return;
95 } 94 }
96 95
97 sb.append(String.format("<font color=\"%s\">%s</font><br/>", color, mess age)); 96 sb.append(String.format("<font color=\"%s\">%s</font><br/>", color, mess age));
98 } 97 }
99 98
100 private void appendPrerequisitesReport(StringBuilder sb) { 99 private void appendPrerequisitesReport(StringBuilder sb) {
101 boolean isSdkVersionCorrect = isSdkVersionCorrect(); 100 boolean isSdkVersionCorrect = isSdkVersionCorrect();
102 boolean isDataConnectionActive = Utils.isDataConnectionActive(mContext); 101 boolean isDataConnectionActive = Utils.isDataConnectionActive(mContext);
103 int bluetoothStatus = Utils.getBluetoothEnabledStatus(mContext); 102 int bluetoothStatus = Utils.getBluetoothEnabledStatus(mContext);
104 LocationUtils locationUtils = LocationUtils.getInstance(); 103 boolean isLocationServicesEnabled = Utils.isLocationServicesEnabled(mCon text);
105 boolean isLocationServicesEnabled = locationUtils.isSystemLocationSettin gEnabled(mContext); 104 boolean isLocationPermissionGranted = Utils.isLocationPermissionGranted( mContext);
106 boolean isLocationPermissionGranted = locationUtils.hasAndroidLocationPe rmission(mContext);
107 boolean isPreferenceEnabled = PhysicalWeb.isPhysicalWebPreferenceEnabled (mContext); 105 boolean isPreferenceEnabled = PhysicalWeb.isPhysicalWebPreferenceEnabled (mContext);
108 boolean isOnboarding = PhysicalWeb.isOnboarding(mContext); 106 boolean isOnboarding = PhysicalWeb.isOnboarding(mContext);
109 107
110 int prerequisitesResult = Utils.RESULT_SUCCESS; 108 int prerequisitesResult = Utils.RESULT_SUCCESS;
111 if (!isSdkVersionCorrect 109 if (!isSdkVersionCorrect
112 || !isDataConnectionActive 110 || !isDataConnectionActive
113 || bluetoothStatus == Utils.RESULT_FAILURE 111 || bluetoothStatus == Utils.RESULT_FAILURE
114 || !isLocationServicesEnabled 112 || !isLocationServicesEnabled
115 || !isLocationPermissionGranted 113 || !isLocationPermissionGranted
116 || !isPreferenceEnabled) { 114 || !isPreferenceEnabled) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 @Override 238 @Override
241 public String getHost() { 239 public String getHost() {
242 return UrlConstants.PHYSICAL_WEB_HOST; 240 return UrlConstants.PHYSICAL_WEB_HOST;
243 } 241 }
244 242
245 @Override 243 @Override
246 public void updateForUrl(String url) { 244 public void updateForUrl(String url) {
247 // nothing to do 245 // nothing to do
248 } 246 }
249 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698