Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / android / traffic_stats.cc
blob6ae5953b83fbbd7799649b2851afb9903115853c
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/android/traffic_stats.h"
7 #include "jni/AndroidTrafficStats_jni.h"
9 namespace net {
11 namespace android {
13 namespace traffic_stats {
15 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
16 enum TrafficStatsError {
17 // Value returned by AndroidTrafficStats APIs when a valid value is
18 // unavailable.
19 ERROR_NOT_SUPPORTED = 0,
22 bool GetTotalTxBytes(int64_t* bytes) {
23 JNIEnv* env = base::android::AttachCurrentThread();
24 *bytes = Java_AndroidTrafficStats_getTotalTxBytes(env);
25 return *bytes != ERROR_NOT_SUPPORTED;
28 bool Register(JNIEnv* env) {
29 return RegisterNativesImpl(env);
32 } // namespace traffic_stats
34 } // namespace android
36 } // namespace net