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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/VisibleNetworks.java

Issue 2880663004: Adding visible networks to the Geolocation Header. (Closed)
Patch Set: Adding visible networks to the Geolocation Header. Created 3 years, 7 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/omnibox/geo/VisibleNetworks.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/VisibleNetworks.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/VisibleNetworks.java
index 0910cce61f0f43bfb9868740d15ceedb80e5a498..6a422773035b953046f77c5d144fedaf5aea1969 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/VisibleNetworks.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/geo/VisibleNetworks.java
@@ -202,6 +202,35 @@ public class VisibleNetworks {
public int hashCode() {
return VisibleNetworks.objectsHash(this.mSsid, this.mBssid);
}
+
+ /**
+ * Encodes a VisibleWifi into its corresponding PartnerLocationDescriptor.VisibleNetwork
+ * proto.
+ */
lbargu 2017/05/16 16:34:52 Ignore changes to this class. See https://coderevi
+ public PartnerLocationDescriptor.VisibleNetwork toProto(boolean connected) {
+ PartnerLocationDescriptor.VisibleNetwork visibleNetwork =
+ new PartnerLocationDescriptor.VisibleNetwork();
+
+ PartnerLocationDescriptor.VisibleNetwork.WiFi wifi =
+ new PartnerLocationDescriptor.VisibleNetwork.WiFi();
+
+ String bssid = this.bssid();
+ if (bssid != null) {
+ wifi.bssid = this.bssid();
+ }
+ Integer level = this.level();
+ if (level != null) {
+ wifi.levelDbm = this.level();
+ }
+ visibleNetwork.wifi = wifi;
+
+ Long timestampMs = this.timestampMs();
+ if (timestampMs != null) {
+ visibleNetwork.timestampMs = timestampMs;
+ }
+ visibleNetwork.connected = connected;
+ return visibleNetwork;
+ }
}
/**
@@ -371,6 +400,80 @@ public class VisibleNetworks {
}
/**
+ * Encodes a VisibleCell into its corresponding PartnerLocationDescriptor.VisibleNetwork
+ * proto.
+ */
+ public PartnerLocationDescriptor.VisibleNetwork toProto(boolean connected) {
+ PartnerLocationDescriptor.VisibleNetwork visibleNetwork =
+ new PartnerLocationDescriptor.VisibleNetwork();
+
+ PartnerLocationDescriptor.VisibleNetwork.Cell cell =
+ new PartnerLocationDescriptor.VisibleNetwork.Cell();
+
+ switch (this.radioType()) {
+ case VisibleCell.CDMA_RADIO_TYPE:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.CDMA;
+ break;
+ case VisibleCell.GSM_RADIO_TYPE:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.GSM;
+ break;
+ case VisibleCell.LTE_RADIO_TYPE:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.LTE;
+ break;
+ case VisibleCell.WCDMA_RADIO_TYPE:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.WCDMA;
+ break;
+ case VisibleCell.UNKNOWN_RADIO_TYPE:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.UNKNOWN;
+ break;
+ case VisibleCell.UNKNOWN_MISSING_LOCATION_PERMISSION_RADIO_TYPE:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.UNKNOWN;
+ break;
+ default:
+ cell.type = PartnerLocationDescriptor.VisibleNetwork.Cell.UNKNOWN;
+ break;
+ }
+
+ Integer cellId = this.cellId();
+ if (cellId != null) {
+ cell.cellId = cellId;
+ }
+ Integer locationAreaCode = this.locationAreaCode();
+ if (locationAreaCode != null) {
+ cell.locationAreaCode = locationAreaCode;
+ }
+ Integer mobileCountryCode = this.mobileCountryCode();
+ if (mobileCountryCode != null) {
+ cell.mobileCountryCode = mobileCountryCode;
+ }
+ Integer mobileNetworkCode = this.mobileNetworkCode();
+ if (mobileNetworkCode != null) {
+ cell.mobileNetworkCode = mobileNetworkCode;
+ }
+ Integer primaryScramblingCode = this.primaryScramblingCode();
+ if (primaryScramblingCode != null) {
+ cell.primaryScramblingCode = primaryScramblingCode;
+ }
+ Integer physicalCellId = this.physicalCellId();
+ if (physicalCellId != null) {
+ cell.physicalCellId = physicalCellId;
+ }
+ Integer trackingAreaCode = this.trackingAreaCode();
+ if (trackingAreaCode != null) {
+ cell.trackingAreaCode = trackingAreaCode;
+ }
+
+ visibleNetwork.cell = cell;
+
+ Long timestampMs = this.timestampMs();
+ if (timestampMs != null) {
+ visibleNetwork.timestampMs = timestampMs;
+ }
+ visibleNetwork.connected = connected;
+ return visibleNetwork;
+ }
+
+ /**
* A {@link VisibleCell} builder.
*/
public static class Builder {

Powered by Google App Engine
This is Rietveld 408576698