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

Side by Side Diff: content/renderer/p2p/socket_dispatcher.h

Issue 9557006: Implement PPB_NetworkMonitor_Private Pepper interface. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/p2p/ipc_network_manager.h ('k') | content/renderer/p2p/socket_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // P2PSocketDispatcher is a per-renderer object that dispatchers all 5 // P2PSocketDispatcher is a per-renderer object that dispatchers all
6 // P2P messages received from the browser and relays all P2P messages 6 // P2P messages received from the browser and relays all P2P messages
7 // sent to the browser. P2PSocketClient instances register themselves 7 // sent to the browser. P2PSocketClient instances register themselves
8 // with the dispatcher using RegisterClient() and UnregisterClient(). 8 // with the dispatcher using RegisterClient() and UnregisterClient().
9 // 9 //
10 // Relationship of classes. 10 // Relationship of classes.
(...skipping 23 matching lines...) Expand all
34 class RenderViewImpl; 34 class RenderViewImpl;
35 35
36 namespace base { 36 namespace base {
37 class MessageLoopProxy; 37 class MessageLoopProxy;
38 } // namespace base 38 } // namespace base
39 39
40 namespace net { 40 namespace net {
41 class IPEndPoint; 41 class IPEndPoint;
42 } // namespace net 42 } // namespace net
43 43
44 namespace webkit_glue {
45 class NetworkListObserver;
46 } // webkit_glue
47
44 namespace content { 48 namespace content {
45 49
46 class P2PHostAddressRequest; 50 class P2PHostAddressRequest;
47 class P2PSocketClient; 51 class P2PSocketClient;
48 52
49 // P2PSocketDispatcher works on the renderer thread. It dispatches all 53 // P2PSocketDispatcher works on the renderer thread. It dispatches all
50 // messages on that thread, and all its methods must be called on the 54 // messages on that thread, and all its methods must be called on the
51 // same thread. 55 // same thread.
52 class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver { 56 class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver {
53 public: 57 public:
54 class NetworkListObserver {
55 public:
56 virtual ~NetworkListObserver() { }
57
58 virtual void OnNetworkListChanged(
59 const net::NetworkInterfaceList& list) = 0;
60
61 protected:
62 NetworkListObserver() { }
63
64 private:
65 DISALLOW_COPY_AND_ASSIGN(NetworkListObserver);
66 };
67
68 explicit P2PSocketDispatcher(RenderViewImpl* render_view); 58 explicit P2PSocketDispatcher(RenderViewImpl* render_view);
69 virtual ~P2PSocketDispatcher(); 59 virtual ~P2PSocketDispatcher();
70 60
71 // Add a new network list observer. Each observer is called 61 // Add a new network list observer. Each observer is called
72 // immidiately after its't registered and then later whenever 62 // immidiately after it is registered and then later whenever
73 // network configuration changes. 63 // network configuration changes.
74 void AddNetworkListObserver(NetworkListObserver* network_list_observer); 64 void AddNetworkListObserver(
65 webkit_glue::NetworkListObserver* network_list_observer);
75 66
76 // Removes network list observer. 67 // Removes network list observer.
77 void RemoveNetworkListObserver(NetworkListObserver* network_list_observer); 68 void RemoveNetworkListObserver(
69 webkit_glue::NetworkListObserver* network_list_observer);
78 70
79 // RenderViewObserver overrides. 71 // RenderViewObserver overrides.
80 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
81 73
82 private: 74 private:
83 friend class P2PHostAddressRequest; 75 friend class P2PHostAddressRequest;
84 friend class P2PSocketClient; 76 friend class P2PSocketClient;
85 class AsyncMessageSender; 77 class AsyncMessageSender;
86 78
87 base::MessageLoopProxy* message_loop(); 79 base::MessageLoopProxy* message_loop();
(...skipping 18 matching lines...) Expand all
106 const std::vector<char>& data); 98 const std::vector<char>& data);
107 99
108 P2PSocketClient* GetClient(int socket_id); 100 P2PSocketClient* GetClient(int socket_id);
109 101
110 scoped_refptr<base::MessageLoopProxy> message_loop_; 102 scoped_refptr<base::MessageLoopProxy> message_loop_;
111 IDMap<P2PSocketClient> clients_; 103 IDMap<P2PSocketClient> clients_;
112 104
113 IDMap<P2PHostAddressRequest> host_address_requests_; 105 IDMap<P2PHostAddressRequest> host_address_requests_;
114 106
115 bool network_notifications_started_; 107 bool network_notifications_started_;
116 scoped_refptr<ObserverListThreadSafe<NetworkListObserver> > 108 scoped_refptr<ObserverListThreadSafe<webkit_glue::NetworkListObserver> >
117 network_list_observers_; 109 network_list_observers_;
118 110
119 scoped_refptr<AsyncMessageSender> async_message_sender_; 111 scoped_refptr<AsyncMessageSender> async_message_sender_;
120 112
121 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); 113 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher);
122 }; 114 };
123 115
124 } // namespace content 116 } // namespace content
125 117
126 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ 118 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/renderer/p2p/ipc_network_manager.h ('k') | content/renderer/p2p/socket_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698