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

Unified Diff: net/android/network_change_notifier.h

Issue 10073024: Add NetworkChangeNotifier for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: net/android/network_change_notifier.h
diff --git a/net/android/network_change_notifier.h b/net/android/network_change_notifier.h
new file mode 100644
index 0000000000000000000000000000000000000000..9b56fe338ec20721b5e4ca631e8bba23df917efe
--- /dev/null
+++ b/net/android/network_change_notifier.h
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_
+#define NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_
+#pragma once
+
+#include "base/android/scoped_java_ref.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "net/base/network_change_notifier.h"
+
+namespace net {
+namespace android {
+
+class NetworkChangeNotifier : public net::NetworkChangeNotifier {
+ public:
+ NetworkChangeNotifier();
+ virtual ~NetworkChangeNotifier();
+
+ void NotifyObservers(JNIEnv* env, jobject obj);
+
+ private:
+ void CreateJavaObject(JNIEnv* env);
+
+ // NetworkChangeNotifier:
+ virtual bool IsCurrentlyOffline() const OVERRIDE;
+
+ base::android::ScopedJavaGlobalRef<jobject>
+ java_network_change_notifier_android_object_;
Ryan Sleevi 2012/04/13 22:37:58 nit: shorten the variable name? Certainly, "_obje
Yaron 2012/04/17 16:18:03 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
+};
+
+bool RegisterNetworkChangeNotifier(JNIEnv* env);
Ryan Sleevi 2012/04/13 22:37:58 Any reason to have this free floating? Can you no
Yaron 2012/04/17 16:18:03 This style is consistent with downstream but that
+
+} // namespace android
+} // namespace net
+
+#endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698