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

Side by Side Diff: net/android/java/src/org/chromium/net/NetworkChangeNotifier.java

Issue 264973019: GetCurrentConnectionType (in NetworkChangeNotifier.java) gets actual connection type if the value i… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Always notify in updateCurrentConnectionType (like before). Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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.net; 5 package org.chromium.net;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.CalledByNative; 9 import org.chromium.base.CalledByNative;
10 import org.chromium.base.JNINamespace; 10 import org.chromium.base.JNINamespace;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (shouldAutoDetect) { 127 if (shouldAutoDetect) {
128 if (mAutoDetector == null) { 128 if (mAutoDetector == null) {
129 mAutoDetector = new NetworkChangeNotifierAutoDetect( 129 mAutoDetector = new NetworkChangeNotifierAutoDetect(
130 new NetworkChangeNotifierAutoDetect.Observer() { 130 new NetworkChangeNotifierAutoDetect.Observer() {
131 @Override 131 @Override
132 public void onConnectionTypeChanged(int newConnectionTyp e) { 132 public void onConnectionTypeChanged(int newConnectionTyp e) {
133 updateCurrentConnectionType(newConnectionType); 133 updateCurrentConnectionType(newConnectionType);
134 } 134 }
135 }, 135 },
136 mContext); 136 mContext);
137 mCurrentConnectionType = mAutoDetector.getCurrentConnectionType( ); 137 updateCurrentConnectionType(mAutoDetector.getCurrentConnectionTy pe());
138 } 138 }
139 } else { 139 } else {
140 destroyAutoDetector(); 140 destroyAutoDetector();
141 } 141 }
142 } 142 }
143 143
144 /** 144 /**
145 * Updates the perceived network state when not auto-detecting changes to co nnectivity. 145 * Updates the perceived network state when not auto-detecting changes to co nnectivity.
146 * 146 *
147 * @param networkAvailable True if the NetworkChangeNotifier should perceive a "connected" 147 * @param networkAvailable True if the NetworkChangeNotifier should perceive a "connected"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 209
210 /** 210 /**
211 * Checks if there currently is connectivity. 211 * Checks if there currently is connectivity.
212 */ 212 */
213 public static boolean isOnline() { 213 public static boolean isOnline() {
214 int connectionType = getInstance().getCurrentConnectionType(); 214 int connectionType = getInstance().getCurrentConnectionType();
215 return connectionType != CONNECTION_UNKNOWN && connectionType != CONNECT ION_NONE; 215 return connectionType != CONNECTION_UNKNOWN && connectionType != CONNECT ION_NONE;
216 } 216 }
217 } 217 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698