Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 #include "net/http/http_content_disposition.h" | 64 #include "net/http/http_content_disposition.h" |
| 65 #include "third_party/icu/source/common/unicode/uidna.h" | 65 #include "third_party/icu/source/common/unicode/uidna.h" |
| 66 #include "third_party/icu/source/common/unicode/uniset.h" | 66 #include "third_party/icu/source/common/unicode/uniset.h" |
| 67 #include "third_party/icu/source/common/unicode/uscript.h" | 67 #include "third_party/icu/source/common/unicode/uscript.h" |
| 68 #include "third_party/icu/source/common/unicode/uset.h" | 68 #include "third_party/icu/source/common/unicode/uset.h" |
| 69 #include "third_party/icu/source/i18n/unicode/datefmt.h" | 69 #include "third_party/icu/source/i18n/unicode/datefmt.h" |
| 70 #include "third_party/icu/source/i18n/unicode/regex.h" | 70 #include "third_party/icu/source/i18n/unicode/regex.h" |
| 71 #include "third_party/icu/source/i18n/unicode/ulocdata.h" | 71 #include "third_party/icu/source/i18n/unicode/ulocdata.h" |
| 72 | 72 |
| 73 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
| 74 #include "base/android/jni_android.h" | |
| 75 #include "base/android/jni_string.h" | |
| 76 #include "jni/Telephony_jni.h" | |
| 74 #include "net/android/network_library.h" | 77 #include "net/android/network_library.h" |
| 75 #endif | 78 #endif |
| 76 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 77 #include "net/base/winsock_init.h" | 80 #include "net/base/winsock_init.h" |
| 78 #endif | 81 #endif |
| 79 | 82 |
| 80 using base::Time; | 83 using base::Time; |
| 81 | 84 |
| 82 namespace net { | 85 namespace net { |
| 83 | 86 |
| (...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1832 NOTREACHED(); | 1835 NOTREACHED(); |
| 1833 } | 1836 } |
| 1834 return a1.size() * CHAR_BIT; | 1837 return a1.size() * CHAR_BIT; |
| 1835 } | 1838 } |
| 1836 | 1839 |
| 1837 unsigned MaskPrefixLength(const IPAddressNumber& mask) { | 1840 unsigned MaskPrefixLength(const IPAddressNumber& mask) { |
| 1838 IPAddressNumber all_ones(mask.size(), 0xFF); | 1841 IPAddressNumber all_ones(mask.size(), 0xFF); |
| 1839 return CommonPrefixLength(mask, all_ones); | 1842 return CommonPrefixLength(mask, all_ones); |
| 1840 } | 1843 } |
| 1841 | 1844 |
| 1845 std::string GetNetworkOperatorID() { | |
| 1846 #if defined(OS_ANDROID) | |
| 1847 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.
| |
| 1848 Java_Telephony_getNetworkOperator( | |
| 1849 base::android::AttachCurrentThread(), | |
| 1850 base::android::GetApplicationContext())); | |
| 1851 #else | |
| 1852 return ""; | |
| 1853 #endif | |
| 1854 } | |
| 1855 | |
| 1856 #if defined(OS_ANDROID) | |
| 1857 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.
| |
| 1858 return RegisterNativesImpl(env); | |
| 1859 } | |
| 1860 #endif | |
| 1861 | |
| 1842 } // namespace net | 1862 } // namespace net |
| OLD | NEW |