| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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. |
| 11 // | 11 // |
| 12 // P2PSocketHost P2PSocketClient | 12 // P2PSocketHost P2PSocketClient |
| 13 // ^ ^ | 13 // ^ ^ |
| 14 // | | | 14 // | | |
| 15 // v IPC v | 15 // v IPC v |
| 16 // P2PSocketDispatcherHost <---------> P2PSocketDispatcher | 16 // P2PSocketDispatcherHost <---------> P2PSocketDispatcher |
| 17 // | 17 // |
| 18 | 18 |
| 19 #ifndef CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 19 #ifndef CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
| 20 #define CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 20 #define CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
| 21 | 21 |
| 22 #include <vector> | 22 #include <vector> |
| 23 | 23 |
| 24 #include "base/callback_forward.h" | 24 #include "base/callback_forward.h" |
| 25 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
| 26 #include "base/id_map.h" | 26 #include "base/id_map.h" |
| 27 #include "base/observer_list_threadsafe.h" | 27 #include "base/observer_list_threadsafe.h" |
| 28 #include "base/synchronization/lock.h" | 28 #include "base/synchronization/lock.h" |
| 29 #include "content/common/content_export.h" | |
| 30 #include "content/common/p2p_sockets.h" | 29 #include "content/common/p2p_sockets.h" |
| 31 #include "content/public/renderer/render_view_observer.h" | 30 #include "content/public/renderer/render_view_observer.h" |
| 32 #include "net/base/net_util.h" | 31 #include "net/base/net_util.h" |
| 33 | 32 |
| 34 class RenderViewImpl; | 33 class RenderViewImpl; |
| 35 | 34 |
| 36 namespace base { | 35 namespace base { |
| 37 class MessageLoopProxy; | 36 class MessageLoopProxy; |
| 38 } // namespace base | 37 } // namespace base |
| 39 | 38 |
| 40 namespace net { | 39 namespace net { |
| 41 class IPEndPoint; | 40 class IPEndPoint; |
| 42 } // namespace net | 41 } // namespace net |
| 43 | 42 |
| 44 namespace content { | 43 namespace content { |
| 45 | 44 |
| 46 class P2PHostAddressRequest; | 45 class P2PHostAddressRequest; |
| 47 class P2PSocketClient; | 46 class P2PSocketClient; |
| 48 | 47 |
| 49 // P2PSocketDispatcher works on the renderer thread. It dispatches all | 48 // P2PSocketDispatcher works on the renderer thread. It dispatches all |
| 50 // messages on that thread, and all its methods must be called on the | 49 // messages on that thread, and all its methods must be called on the |
| 51 // same thread. | 50 // same thread. |
| 52 class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver { | 51 class P2PSocketDispatcher : public content::RenderViewObserver { |
| 53 public: | 52 public: |
| 54 class NetworkListObserver { | 53 class NetworkListObserver { |
| 55 public: | 54 public: |
| 56 virtual ~NetworkListObserver() { } | 55 virtual ~NetworkListObserver() { } |
| 57 | 56 |
| 58 virtual void OnNetworkListChanged( | 57 virtual void OnNetworkListChanged( |
| 59 const net::NetworkInterfaceList& list) = 0; | 58 const net::NetworkInterfaceList& list) = 0; |
| 60 | 59 |
| 61 protected: | 60 protected: |
| 62 NetworkListObserver() { } | 61 NetworkListObserver() { } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 network_list_observers_; | 116 network_list_observers_; |
| 118 | 117 |
| 119 scoped_refptr<AsyncMessageSender> async_message_sender_; | 118 scoped_refptr<AsyncMessageSender> async_message_sender_; |
| 120 | 119 |
| 121 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); | 120 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); |
| 122 }; | 121 }; |
| 123 | 122 |
| 124 } // namespace content | 123 } // namespace content |
| 125 | 124 |
| 126 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 125 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
| OLD | NEW |