Chromium Code Reviews| Index: ppapi/utility/private/network_list_observer.h |
| diff --git a/ppapi/utility/private/network_list_observer.h b/ppapi/utility/private/network_list_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e9140c3d28e34473fba031c2c26a5b81bbbe6bb1 |
| --- /dev/null |
| +++ b/ppapi/utility/private/network_list_observer.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 PPAPI_UTILITY_PRIVATE_NETWORK_LIST_OBSERVER_H_ |
| +#define PPAPI_UTILITY_PRIVATE_NETWORK_LIST_OBSERVER_H_ |
| + |
| +#include "ppapi/cpp/private/network_monitor_private.h" |
| + |
| +namespace pp { |
| + |
| +class NetworkListPrivate; |
| + |
| +/// <code>NetworkListObserver</code> is a wrapper for |
| +/// <code>pp::NetworkMonitorPrivate</code> that makes it easier to |
| +/// handle network list update notifications. A child class must |
| +/// implement the <code>OnNetworkListChanged()</code> method. That |
| +/// method will be called once after the object is created and then |
| +/// every time network configuration changes. |
| +class NetworkListObserver { |
|
dmichael (off chromium)
2012/03/16 20:06:11
Hmm, should this be named NetworkListObserverPriva
Sergey Ulanov
2012/03/17 00:43:48
Done.
|
| + public: |
| + explicit NetworkListObserver(const InstanceHandle& instance); |
| + virtual ~NetworkListObserver(); |
| + |
| + protected: |
| + /// Called once after this object is created and later every time |
| + /// network configuration changes. Child classes must implement this |
| + /// method. |
| + /// |
| + /// @param[in] list The current list of network interfaces. |
| + virtual void OnNetworkListChanged(const NetworkListPrivate& list) = 0; |
| + |
| + private: |
| + static void NetworkListCallbackHandler(void* user_data, |
| + PP_Resource list_resource); |
| + |
| + NetworkMonitorPrivate monitor_; |
| +}; |
| + |
| +} // namespace pp |
| + |
| +#endif // PPAPI_UTILITY_PRIVATE_NETWORK_LIST_OBSERVER_H_ |