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

Unified Diff: ppapi/utility/private/network_list_observer.cc

Issue 9696051: Add NetworkListObserver utility class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 9 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: ppapi/utility/private/network_list_observer.cc
diff --git a/ppapi/utility/private/network_list_observer.cc b/ppapi/utility/private/network_list_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1f8a362a9f204936c007c8153937d03886b5eef7
--- /dev/null
+++ b/ppapi/utility/private/network_list_observer.cc
@@ -0,0 +1,31 @@
+// 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.
+
+#include "ppapi/utility/private/network_list_observer.h"
+
+#include "ppapi/cpp/private/network_list_private.h"
+#include "ppapi/cpp/module.h"
+
+namespace pp {
+
+NetworkListObserver::NetworkListObserver(const InstanceHandle& instance)
+ : monitor_(instance, &NetworkListObserver::NetworkListCallbackHandler,
+ this) {
dmichael (off chromium) 2012/03/16 20:06:11 You probably need to use PP_ALLOW_THIS_IN_INITIALI
Sergey Ulanov 2012/03/17 00:43:48 Done.
+}
+
+NetworkListObserver::~NetworkListObserver() {
+}
+
+// static
+void NetworkListObserver::NetworkListCallbackHandler(
+ void* user_data,
+ PP_Resource list_resource) {
+ NetworkListObserver* object =
+ static_cast<NetworkListObserver*>(user_data);
dmichael (off chromium) 2012/03/16 20:06:11 style nit: looks like this might fit on 1 line?
Sergey Ulanov 2012/03/17 00:43:48 Done.
+ NetworkListPrivate list(list_resource);
+ object->OnNetworkListChanged(list);
+ Module::Get()->core()->ReleaseResource(list_resource);
+}
+
+} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698