OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/observer_list_threadsafe.h" | 10 #include "base/observer_list.h" |
11 #include "ppapi/proxy/interface_proxy.h" | 11 #include "ppapi/proxy/interface_proxy.h" |
12 #include "ppapi/shared_impl/ppb_network_list_private_shared.h" | 12 #include "ppapi/shared_impl/ppb_network_list_private_shared.h" |
13 #include "ppapi/shared_impl/scoped_pp_resource.h" | 13 #include "ppapi/shared_impl/scoped_pp_resource.h" |
14 #include "ppapi/thunk/ppb_network_monitor_private_api.h" | 14 #include "ppapi/thunk/ppb_network_monitor_api.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class MessageLoopProxy; | 17 class MessageLoopProxy; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace ppapi { | 20 namespace ppapi { |
21 namespace proxy { | 21 namespace proxy { |
22 | 22 |
23 class PPB_NetworkMonitor_Private_Proxy : public InterfaceProxy { | 23 class PPB_NetworkMonitor_Private_Proxy : public InterfaceProxy { |
24 public: | 24 public: |
25 explicit PPB_NetworkMonitor_Private_Proxy(Dispatcher* dispatcher); | 25 explicit PPB_NetworkMonitor_Private_Proxy(Dispatcher* dispatcher); |
26 virtual ~PPB_NetworkMonitor_Private_Proxy(); | 26 virtual ~PPB_NetworkMonitor_Private_Proxy(); |
27 | 27 |
28 // Creates n NetworkManager object in the plugin process. | 28 // Creates n NetworkManager object in the plugin process. |
29 static PP_Resource CreateProxyResource(PP_Instance instance, | 29 static PP_Resource CreateProxyResource(PP_Instance instance); |
30 PPB_NetworkMonitor_Callback callback, | |
31 void* user_data); | |
32 | 30 |
33 // InterfaceProxy implementation. | 31 // InterfaceProxy implementation. |
34 virtual bool OnMessageReceived(const IPC::Message& msg); | 32 virtual bool OnMessageReceived(const IPC::Message& msg); |
35 | 33 |
36 static const ApiID kApiID = API_ID_PPB_NETWORKMANAGER_PRIVATE; | 34 static const ApiID kApiID = API_ID_PPB_NETWORKMANAGER_PRIVATE; |
37 | 35 |
38 private: | 36 private: |
39 class NetworkMonitor; | 37 class NetworkMonitor; |
40 friend class NetworkMonitor; | 38 friend class NetworkMonitor; |
41 | 39 |
42 // IPC message handler for the messages received from the browser. | 40 // IPC message handler for the messages received from the browser. |
43 void OnPluginMsgNetworkList(uint32 plugin_dispatcher_id, | 41 void OnPluginMsgNetworkList(uint32 plugin_dispatcher_id, |
44 const ppapi::NetworkList& list); | 42 const ppapi::NetworkList& list); |
45 | 43 |
46 // Called by NetworkMonitor destructor. | 44 // Called by NetworkMonitor destructor. |
47 void OnNetworkMonitorDeleted(NetworkMonitor* monitor, | 45 void OnNetworkMonitorDeleted(NetworkMonitor* monitor, |
48 PP_Instance instance); | 46 PP_Instance instance); |
49 | 47 |
50 // We use ObserverListThreadSafe because we want to send notifications to the | 48 ObserverList<NetworkMonitor> monitors_; |
51 // same thread that created the NetworkMonitor. | |
52 scoped_refptr<ObserverListThreadSafe<NetworkMonitor> > monitors_; | |
53 | 49 |
54 int monitors_count_; | |
55 scoped_refptr<NetworkListStorage> current_list_; | 50 scoped_refptr<NetworkListStorage> current_list_; |
56 | 51 |
57 DISALLOW_COPY_AND_ASSIGN(PPB_NetworkMonitor_Private_Proxy); | 52 DISALLOW_COPY_AND_ASSIGN(PPB_NetworkMonitor_Private_Proxy); |
58 }; | 53 }; |
59 | 54 |
60 } // namespace proxy | 55 } // namespace proxy |
61 } // namespace ppapi | 56 } // namespace ppapi |
62 | 57 |
63 #endif // PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ | 58 #endif // PPAPI_PROXY_PPB_NETWORK_MONITOR_PRIVATE_PROXY_H_ |
OLD | NEW |