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

Unified Diff: net/base/net_util.cc

Issue 238793007: Added GetNetworkOperatorID util func in net/base/net_util and a non-trivial implementation for Andr… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
« no previous file with comments | « net/base/net_util.h ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util.cc
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index 106486df248e47db22675b669da71739ba546ba0..0333f1b862e3a02161f88f71f863a8cbab4c9e34 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -71,6 +71,9 @@
#include "third_party/icu/source/i18n/unicode/ulocdata.h"
#if defined(OS_ANDROID)
+#include "base/android/jni_android.h"
+#include "base/android/jni_string.h"
+#include "jni/Telephony_jni.h"
#include "net/android/network_library.h"
#endif
#if defined(OS_WIN)
@@ -1839,4 +1842,21 @@ unsigned MaskPrefixLength(const IPAddressNumber& mask) {
return CommonPrefixLength(mask, all_ones);
}
+std::string GetNetworkOperatorID() {
+#if defined(OS_ANDROID)
+ return base::android::ConvertJavaStringToUTF8(
mef 2014/04/16 20:57:57 I meant move this Android-specific implementation
bolian 2014/04/16 23:40:52 Done. Yes, I think that is better.
+ Java_Telephony_getNetworkOperator(
+ base::android::AttachCurrentThread(),
+ base::android::GetApplicationContext()));
+#else
+ return "";
+#endif
+}
+
+#if defined(OS_ANDROID)
+bool NetworkInfo_GetNetworkOperatorID(JNIEnv* env) {
mef 2014/04/16 20:57:57 This could go to android-specific module.
bolian 2014/04/16 23:40:52 Done.
+ return RegisterNativesImpl(env);
+}
+#endif
+
} // namespace net
« no previous file with comments | « net/base/net_util.h ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698