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

Side by Side Diff: net/android/network_change_notifier_android.cc

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed a typo Created 8 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 | « net/android/network_change_notifier_android.h ('k') | net/base/network_change_notifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "net/android/network_change_notifier_android.h" 5 #include "net/android/network_change_notifier_android.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "jni/network_change_notifier_jni.h" 9 #include "jni/network_change_notifier_jni.h"
10 10
(...skipping 13 matching lines...) Expand all
24 24
25 void NetworkChangeNotifier::CreateJavaObject(JNIEnv* env) { 25 void NetworkChangeNotifier::CreateJavaObject(JNIEnv* env) {
26 java_network_change_notifier_.Reset( 26 java_network_change_notifier_.Reset(
27 Java_NetworkChangeNotifier_create( 27 Java_NetworkChangeNotifier_create(
28 env, 28 env,
29 base::android::GetApplicationContext(), 29 base::android::GetApplicationContext(),
30 reinterpret_cast<jint>(this))); 30 reinterpret_cast<jint>(this)));
31 } 31 }
32 32
33 void NetworkChangeNotifier::NotifyObservers(JNIEnv* env, jobject obj) { 33 void NetworkChangeNotifier::NotifyObservers(JNIEnv* env, jobject obj) {
34 NotifyObserversOfOnlineStateChange(); 34 NotifyObserversOfConnectionTypeChange();
35 } 35 }
36 36
37 bool NetworkChangeNotifier::IsCurrentlyOffline() const { 37 net::NetworkChangeNotifier::ConnectionType
38 NetworkChangeNotifier::GetCurrentConnectionType() const {
38 JNIEnv* env = base::android::AttachCurrentThread(); 39 JNIEnv* env = base::android::AttachCurrentThread();
39 return !Java_NetworkChangeNotifier_isConnected( 40 // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN.
40 env, java_network_change_notifier_.obj()); 41 return Java_NetworkChangeNotifier_isConnected(
42 env, java_network_change_notifier_.obj()) ?
43 net::NetworkChangeNotifier::CONNECTION_UNKNOWN :
44 net::NetworkChangeNotifier::CONNECTION_NONE;
41 } 45 }
42 46
43 // static 47 // static
44 bool NetworkChangeNotifier::Register(JNIEnv* env) { 48 bool NetworkChangeNotifier::Register(JNIEnv* env) {
45 return RegisterNativesImpl(env); 49 return RegisterNativesImpl(env);
46 } 50 }
47 51
48 } // namespace android 52 } // namespace android
49 } // namespace net 53 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_change_notifier_android.h ('k') | net/base/network_change_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698