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

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

Issue 10384025: fix duplicated basename network_change_notifier.cc in net target (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « net/android/network_change_notifier.h ('k') | net/android/network_change_notifier_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/android/network_change_notifier.h"
6
7 #include "base/logging.h"
8 #include "base/android/jni_android.h"
9 #include "jni/network_change_notifier_jni.h"
10
11 namespace net {
12 namespace android {
13
14 NetworkChangeNotifier::NetworkChangeNotifier() {
15 JNIEnv* env = base::android::AttachCurrentThread();
16 CreateJavaObject(env);
17 }
18
19 NetworkChangeNotifier::~NetworkChangeNotifier() {
20 JNIEnv* env = base::android::AttachCurrentThread();
21 Java_NetworkChangeNotifier_unregisterReceiver(
22 env, java_network_change_notifier_.obj());
23 }
24
25 void NetworkChangeNotifier::CreateJavaObject(JNIEnv* env) {
26 java_network_change_notifier_.Reset(
27 Java_NetworkChangeNotifier_create(
28 env,
29 base::android::GetApplicationContext(),
30 reinterpret_cast<jint>(this)));
31 }
32
33 void NetworkChangeNotifier::NotifyObservers(JNIEnv* env, jobject obj) {
34 NotifyObserversOfOnlineStateChange();
35 }
36
37 bool NetworkChangeNotifier::IsCurrentlyOffline() const {
38 JNIEnv* env = base::android::AttachCurrentThread();
39 return !Java_NetworkChangeNotifier_isConnected(
40 env, java_network_change_notifier_.obj());
41 }
42
43 // static
44 bool NetworkChangeNotifier::Register(JNIEnv* env) {
45 return RegisterNativesImpl(env);
46 }
47
48 } // namespace android
49 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_change_notifier.h ('k') | net/android/network_change_notifier_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698