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

Unified Diff: ppapi/utility/private/network_list_observer_private.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_private.cc
diff --git a/ppapi/utility/private/network_list_observer_private.cc b/ppapi/utility/private/network_list_observer_private.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f41e81b9d9a43c2fd7917e61c18e3540cf407b2c
--- /dev/null
+++ b/ppapi/utility/private/network_list_observer_private.cc
@@ -0,0 +1,34 @@
+// 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_private.h"
+
+#include "ppapi/cpp/private/network_list_private.h"
+#include "ppapi/cpp/module.h"
+
+namespace pp {
+
+NetworkListObserverPrivate::NetworkListObserverPrivate(
+ const InstanceHandle& instance)
+ : PP_ALLOW_THIS_IN_INITIALIZER_LIST(
+ monitor_(instance,
+ &NetworkListObserverPrivate::NetworkListCallbackHandler,
+ this)) {
+}
+
+NetworkListObserverPrivate::~NetworkListObserverPrivate() {
+}
+
+// static
+void NetworkListObserverPrivate::NetworkListCallbackHandler(
+ void* user_data,
+ PP_Resource list_resource) {
+ NetworkListObserverPrivate* object =
+ static_cast<NetworkListObserverPrivate*>(user_data);
+ NetworkListPrivate list(list_resource);
+ object->OnNetworkListChanged(list);
+ Module::Get()->core()->ReleaseResource(list_resource);
+}
+
+} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698