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.
5 #ifndef PPAPI_UTILITY_PRIVATE_NETWORK_LIST_OBSERVER_H_
6 #define PPAPI_UTILITY_PRIVATE_NETWORK_LIST_OBSERVER_H_
8 #include "ppapi/cpp/private/network_monitor_private.h"
12 class NetworkListPrivate
;
14 /// <code>NetworkListObserver</code> is a wrapper for
15 /// <code>pp::NetworkMonitorPrivate</code> that makes it easier to
16 /// handle network list update notifications. A child class must
17 /// implement the <code>OnNetworkListChanged()</code> method. That
18 /// method will be called once after the object is created and then
19 /// every time network configuration changes.
20 class NetworkListObserverPrivate
{
22 explicit NetworkListObserverPrivate(const InstanceHandle
& instance
);
23 virtual ~NetworkListObserverPrivate();
26 /// Called once after this object is created and later every time
27 /// network configuration changes. Child classes must implement this
30 /// @param[in] list The current list of network interfaces.
31 virtual void OnNetworkListChanged(const NetworkListPrivate
& list
) = 0;
34 // Private copy constructor and assign operator to disallow copying of this
35 // object. This is necessary to guarantee that |monitor_| is not shared with
36 // another list observer and is always destroyed when this object is
38 NetworkListObserverPrivate(const NetworkListObserverPrivate
&);
39 void operator=(const NetworkListObserverPrivate
&);
41 static void NetworkListCallbackHandler(void* user_data
,
42 PP_Resource list_resource
);
44 NetworkMonitorPrivate monitor_
;
49 #endif // PPAPI_UTILITY_PRIVATE_NETWORK_LIST_OBSERVER_H_