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

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

Issue 301973002: Support Bluetooth network connection type on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth
Patch Set: Fix Created 6 years, 6 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/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java ('k') | 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 (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_delegate_android.h" 5 #include "net/android/network_change_notifier_delegate_android.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "jni/NetworkChangeNotifier_jni.h" 8 #include "jni/NetworkChangeNotifier_jni.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace { 12 namespace {
13 13
14 // Converts a Java side connection type (integer) to 14 // Converts a Java side connection type (integer) to
15 // the native side NetworkChangeNotifier::ConnectionType. 15 // the native side NetworkChangeNotifier::ConnectionType.
16 NetworkChangeNotifier::ConnectionType ConvertConnectionType( 16 NetworkChangeNotifier::ConnectionType ConvertConnectionType(
17 jint connection_type) { 17 jint connection_type) {
18 switch (connection_type) { 18 switch (connection_type) {
19 case NetworkChangeNotifier::CONNECTION_UNKNOWN: 19 case NetworkChangeNotifier::CONNECTION_UNKNOWN:
20 case NetworkChangeNotifier::CONNECTION_ETHERNET: 20 case NetworkChangeNotifier::CONNECTION_ETHERNET:
21 case NetworkChangeNotifier::CONNECTION_WIFI: 21 case NetworkChangeNotifier::CONNECTION_WIFI:
22 case NetworkChangeNotifier::CONNECTION_2G: 22 case NetworkChangeNotifier::CONNECTION_2G:
23 case NetworkChangeNotifier::CONNECTION_3G: 23 case NetworkChangeNotifier::CONNECTION_3G:
24 case NetworkChangeNotifier::CONNECTION_4G: 24 case NetworkChangeNotifier::CONNECTION_4G:
25 case NetworkChangeNotifier::CONNECTION_NONE: 25 case NetworkChangeNotifier::CONNECTION_NONE:
26 case NetworkChangeNotifier::CONNECTION_BLUETOOTH:
26 break; 27 break;
27 default: 28 default:
28 NOTREACHED() << "Unknown connection type received: " << connection_type; 29 NOTREACHED() << "Unknown connection type received: " << connection_type;
29 return NetworkChangeNotifier::CONNECTION_UNKNOWN; 30 return NetworkChangeNotifier::CONNECTION_UNKNOWN;
30 } 31 }
31 return static_cast<NetworkChangeNotifier::ConnectionType>(connection_type); 32 return static_cast<NetworkChangeNotifier::ConnectionType>(connection_type);
32 } 33 }
33 34
34 } // namespace 35 } // namespace
35 36
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 JNIEnv* env = base::android::AttachCurrentThread(); 106 JNIEnv* env = base::android::AttachCurrentThread();
106 Java_NetworkChangeNotifier_forceConnectivityState(env, true); 107 Java_NetworkChangeNotifier_forceConnectivityState(env, true);
107 } 108 }
108 109
109 void NetworkChangeNotifierDelegateAndroid::SetOffline() { 110 void NetworkChangeNotifierDelegateAndroid::SetOffline() {
110 JNIEnv* env = base::android::AttachCurrentThread(); 111 JNIEnv* env = base::android::AttachCurrentThread();
111 Java_NetworkChangeNotifier_forceConnectivityState(env, false); 112 Java_NetworkChangeNotifier_forceConnectivityState(env, false);
112 } 113 }
113 114
114 } // namespace net 115 } // namespace net
OLDNEW
« no previous file with comments | « net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698