diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-27 05:57:22 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-27 05:57:22 +0000 |
commit | 5dba679eddcb4b66c57b4b8037481e8501a675c5 (patch) | |
tree | 7854277f24f93faeaa8d0dc5233701c67b7d226f | |
parent | 8935df6e2f357b1dc89e386abc0731b54b1f6be8 (diff) | |
download | chromium_src-5dba679eddcb4b66c57b4b8037481e8501a675c5.zip chromium_src-5dba679eddcb4b66c57b4b8037481e8501a675c5.tar.gz chromium_src-5dba679eddcb4b66c57b4b8037481e8501a675c5.tar.bz2 |
Move NetworkListObserver out of webkit/glue
R=jam@chromium.org
Review URL: https://codereview.chromium.org/20855002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214040 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/renderer/p2p/ipc_network_manager.h | 4 | ||||
-rw-r--r-- | content/renderer/p2p/network_list_observer.h (renamed from webkit/glue/network_list_observer.h) | 15 | ||||
-rw-r--r-- | content/renderer/p2p/socket_dispatcher.cc | 10 | ||||
-rw-r--r-- | content/renderer/p2p/socket_dispatcher.h | 13 | ||||
-rw-r--r-- | content/renderer/pepper/mock_plugin_delegate.cc | 9 | ||||
-rw-r--r-- | content/renderer/pepper/mock_plugin_delegate.h | 4 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_delegate_impl.cc | 25 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_plugin_delegate_impl.h | 4 | ||||
-rw-r--r-- | content/renderer/pepper/plugin_delegate.h | 11 | ||||
-rw-r--r-- | content/renderer/pepper/ppb_network_monitor_private_impl.cc | 38 | ||||
-rw-r--r-- | content/renderer/pepper/ppb_network_monitor_private_impl.h | 4 | ||||
-rw-r--r-- | content/renderer/pepper/ppb_scrollbar_impl.cc | 1 | ||||
-rw-r--r-- | content/renderer/pepper/ppb_uma_private_impl.cc | 1 |
13 files changed, 49 insertions, 90 deletions
diff --git a/content/renderer/p2p/ipc_network_manager.h b/content/renderer/p2p/ipc_network_manager.h index 17b042a..06931dc 100644 --- a/content/renderer/p2p/ipc_network_manager.h +++ b/content/renderer/p2p/ipc_network_manager.h @@ -10,16 +10,16 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "content/common/content_export.h" +#include "content/renderer/p2p/network_list_observer.h" #include "content/renderer/p2p/socket_dispatcher.h" #include "third_party/libjingle/source/talk/base/network.h" -#include "webkit/glue/network_list_observer.h" namespace content { // IpcNetworkManager is a NetworkManager for libjingle that gets a // list of network interfaces from the browser. class IpcNetworkManager : public talk_base::NetworkManagerBase, - public webkit_glue::NetworkListObserver { + public NetworkListObserver { public: // Constructor doesn't take ownership of the |socket_dispatcher|. CONTENT_EXPORT IpcNetworkManager(P2PSocketDispatcher* socket_dispatcher); diff --git a/webkit/glue/network_list_observer.h b/content/renderer/p2p/network_list_observer.h index 288bfa7..0b39c17 100644 --- a/webkit/glue/network_list_observer.h +++ b/content/renderer/p2p/network_list_observer.h @@ -1,9 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 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 WEBKIT_GLUE_NETWORK_LIST_OBSERVER_H_ -#define WEBKIT_GLUE_NETWORK_LIST_OBSERVER_H_ +#ifndef CONTENT_RENDERER_P2P_NETWORK_LIST_OBSERVER_H_ +#define CONTENT_RENDERER_P2P_NETWORK_LIST_OBSERVER_H_ #include <vector> @@ -12,7 +12,7 @@ struct NetworkInterface; typedef std::vector<NetworkInterface> NetworkInterfaceList; } // namespace net -namespace webkit_glue { +namespace content { class NetworkListObserver { public: @@ -23,11 +23,8 @@ class NetworkListObserver { protected: NetworkListObserver() {} - - private: - DISALLOW_COPY_AND_ASSIGN(NetworkListObserver); }; -} // namespace webkit_glue +} // namespace content -#endif // WEBKIT_GLUE_NETWORK_LIST_OBSERVER_H_ +#endif // CONTENT_RENDERER_P2P_NETWORK_LIST_OBSERVER_H_ diff --git a/content/renderer/p2p/socket_dispatcher.cc b/content/renderer/p2p/socket_dispatcher.cc index d7fcf1d..e3a47a1 100644 --- a/content/renderer/p2p/socket_dispatcher.cc +++ b/content/renderer/p2p/socket_dispatcher.cc @@ -10,9 +10,9 @@ #include "content/child/child_process.h" #include "content/common/p2p_messages.h" #include "content/renderer/p2p/host_address_request.h" +#include "content/renderer/p2p/network_list_observer.h" #include "content/renderer/p2p/socket_client.h" #include "content/renderer/render_view_impl.h" -#include "webkit/glue/network_list_observer.h" namespace content { @@ -21,7 +21,7 @@ P2PSocketDispatcher::P2PSocketDispatcher( : message_loop_(ipc_message_loop), network_notifications_started_(false), network_list_observers_( - new ObserverListThreadSafe<webkit_glue::NetworkListObserver>()), + new ObserverListThreadSafe<NetworkListObserver>()), channel_(NULL) { } @@ -34,14 +34,14 @@ P2PSocketDispatcher::~P2PSocketDispatcher() { } void P2PSocketDispatcher::AddNetworkListObserver( - webkit_glue::NetworkListObserver* network_list_observer) { + NetworkListObserver* network_list_observer) { network_list_observers_->AddObserver(network_list_observer); network_notifications_started_ = true; SendP2PMessage(new P2PHostMsg_StartNetworkNotifications()); } void P2PSocketDispatcher::RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* network_list_observer) { + NetworkListObserver* network_list_observer) { network_list_observers_->RemoveObserver(network_list_observer); } @@ -122,7 +122,7 @@ void P2PSocketDispatcher::UnregisterHostAddressRequest(int id) { void P2PSocketDispatcher::OnNetworkListChanged( const net::NetworkInterfaceList& networks) { network_list_observers_->Notify( - &webkit_glue::NetworkListObserver::OnNetworkListChanged, networks); + &NetworkListObserver::OnNetworkListChanged, networks); } void P2PSocketDispatcher::OnGetHostAddressResult( diff --git a/content/renderer/p2p/socket_dispatcher.h b/content/renderer/p2p/socket_dispatcher.h index cbd8f2a..34c78a1 100644 --- a/content/renderer/p2p/socket_dispatcher.h +++ b/content/renderer/p2p/socket_dispatcher.h @@ -41,12 +41,9 @@ namespace net { class IPEndPoint; } // namespace net -namespace webkit_glue { -class NetworkListObserver; -} // webkit_glue - namespace content { +class NetworkListObserver; class RenderViewImpl; class P2PHostAddressRequest; class P2PSocketClient; @@ -60,13 +57,11 @@ class CONTENT_EXPORT P2PSocketDispatcher // immidiately after it is registered and then later whenever // network configuration changes. Can be called on any thread. The // observer is always called on the thread it was added. - void AddNetworkListObserver( - webkit_glue::NetworkListObserver* network_list_observer); + void AddNetworkListObserver(NetworkListObserver* network_list_observer); // Removes network list observer. Must be called on the thread on // which the observer was added. - void RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* network_list_observer); + void RemoveNetworkListObserver(NetworkListObserver* network_list_observer); protected: virtual ~P2PSocketDispatcher(); @@ -115,7 +110,7 @@ class CONTENT_EXPORT P2PSocketDispatcher IDMap<P2PHostAddressRequest> host_address_requests_; bool network_notifications_started_; - scoped_refptr<ObserverListThreadSafe<webkit_glue::NetworkListObserver> > + scoped_refptr<ObserverListThreadSafe<NetworkListObserver> > network_list_observers_; IPC::Channel* channel_; diff --git a/content/renderer/pepper/mock_plugin_delegate.cc b/content/renderer/pepper/mock_plugin_delegate.cc index 1065b09..d84ae2b 100644 --- a/content/renderer/pepper/mock_plugin_delegate.cc +++ b/content/renderer/pepper/mock_plugin_delegate.cc @@ -271,15 +271,6 @@ void MockPluginDelegate::TCPServerSocketStopListening( uint32 socket_id) { } -bool MockPluginDelegate::AddNetworkListObserver( - webkit_glue::NetworkListObserver* observer) { - return false; -} - -void MockPluginDelegate::RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* observer) { -} - bool MockPluginDelegate::X509CertificateParseDER( const std::vector<char>& der, ::ppapi::PPB_X509Certificate_Fields* fields) { diff --git a/content/renderer/pepper/mock_plugin_delegate.h b/content/renderer/pepper/mock_plugin_delegate.h index 5d3ff61..dec3ebb 100644 --- a/content/renderer/pepper/mock_plugin_delegate.h +++ b/content/renderer/pepper/mock_plugin_delegate.h @@ -137,10 +137,6 @@ class MockPluginDelegate : public PluginDelegate { virtual void TCPServerSocketStopListening(PP_Resource socket_resource, uint32 socket_id) OVERRIDE; // Add/remove a network list observer. - virtual bool AddNetworkListObserver( - webkit_glue::NetworkListObserver* observer) OVERRIDE; - virtual void RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* observer) OVERRIDE; virtual bool X509CertificateParseDER( const std::vector<char>& der, ::ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE; diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc index daf76ec..6f2be66 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc @@ -1031,31 +1031,6 @@ void PepperPluginDelegateImpl::TCPServerSocketStopListening( } } -bool PepperPluginDelegateImpl::AddNetworkListObserver( - webkit_glue::NetworkListObserver* observer) { -#if defined(ENABLE_WEBRTC) - P2PSocketDispatcher* socket_dispatcher = - RenderThreadImpl::current()->p2p_socket_dispatcher(); - if (!socket_dispatcher) { - return false; - } - socket_dispatcher->AddNetworkListObserver(observer); - return true; -#else - return false; -#endif -} - -void PepperPluginDelegateImpl::RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* observer) { -#if defined(ENABLE_WEBRTC) - P2PSocketDispatcher* socket_dispatcher = - RenderThreadImpl::current()->p2p_socket_dispatcher(); - if (socket_dispatcher) - socket_dispatcher->RemoveNetworkListObserver(observer); -#endif -} - bool PepperPluginDelegateImpl::X509CertificateParseDER( const std::vector<char>& der, ppapi::PPB_X509Certificate_Fields* fields) { diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h index de79597..f304c7b 100644 --- a/content/renderer/pepper/pepper_plugin_delegate_impl.h +++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h @@ -235,10 +235,6 @@ class PepperPluginDelegateImpl virtual void TCPServerSocketStopListening( PP_Resource socket_resource, uint32 socket_id) OVERRIDE; - virtual bool AddNetworkListObserver( - webkit_glue::NetworkListObserver* observer) OVERRIDE; - virtual void RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* observer) OVERRIDE; virtual bool X509CertificateParseDER( const std::vector<char>& der, ppapi::PPB_X509Certificate_Fields* fields) OVERRIDE; diff --git a/content/renderer/pepper/plugin_delegate.h b/content/renderer/pepper/plugin_delegate.h index 6381568..0e3a5cb 100644 --- a/content/renderer/pepper/plugin_delegate.h +++ b/content/renderer/pepper/plugin_delegate.h @@ -98,11 +98,6 @@ class WebURLLoaderClient; class WebURLResponse; } -namespace webkit_glue { -class P2PTransport; -class NetworkListObserver; -} // namespace webkit_glue - namespace content { class FileIO; @@ -437,12 +432,6 @@ class PluginDelegate { PP_Resource socket_resource, uint32 socket_id) = 0; - // Add/remove a network list observer. - virtual bool AddNetworkListObserver( - webkit_glue::NetworkListObserver* observer) = 0; - virtual void RemoveNetworkListObserver( - webkit_glue::NetworkListObserver* observer) = 0; - // For PPB_X509Certificate_Private. virtual bool X509CertificateParseDER( const std::vector<char>& der, diff --git a/content/renderer/pepper/ppb_network_monitor_private_impl.cc b/content/renderer/pepper/ppb_network_monitor_private_impl.cc index eb9d99e..44abb45 100644 --- a/content/renderer/pepper/ppb_network_monitor_private_impl.cc +++ b/content/renderer/pepper/ppb_network_monitor_private_impl.cc @@ -5,13 +5,41 @@ #include "content/renderer/pepper/ppb_network_monitor_private_impl.h" #include "base/bind.h" +#include "content/renderer/p2p/socket_dispatcher.h" #include "content/renderer/pepper/resource_helper.h" +#include "content/renderer/render_thread_impl.h" #include "ppapi/shared_impl/ppb_network_list_private_shared.h" #include "ppapi/shared_impl/private/net_address_private_impl.h" #include "net/base/ip_endpoint.h" #include "net/base/net_util.h" namespace content { +namespace { + +bool AddNetworkListObserver(NetworkListObserver* observer) { +#if defined(ENABLE_WEBRTC) + P2PSocketDispatcher* socket_dispatcher = + RenderThreadImpl::current()->p2p_socket_dispatcher(); + if (!socket_dispatcher) { + return false; + } + socket_dispatcher->AddNetworkListObserver(observer); + return true; +#else + return false; +#endif +} + +void RemoveNetworkListObserver(NetworkListObserver* observer) { +#if defined(ENABLE_WEBRTC) + P2PSocketDispatcher* socket_dispatcher = + RenderThreadImpl::current()->p2p_socket_dispatcher(); + if (socket_dispatcher) + socket_dispatcher->RemoveNetworkListObserver(observer); +#endif +} + +} // namespace PPB_NetworkMonitor_Private_Impl::PPB_NetworkMonitor_Private_Impl( PP_Instance instance, @@ -24,10 +52,7 @@ PPB_NetworkMonitor_Private_Impl::PPB_NetworkMonitor_Private_Impl( } PPB_NetworkMonitor_Private_Impl::~PPB_NetworkMonitor_Private_Impl() { - PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); - if (plugin_delegate && started_) { - plugin_delegate->RemoveNetworkListObserver(this); - } + RemoveNetworkListObserver(this); } // static @@ -48,10 +73,7 @@ PPB_NetworkMonitor_Private_Impl::AsPPB_NetworkMonitor_Private_API() { } bool PPB_NetworkMonitor_Private_Impl::Start() { - PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this); - if (!plugin_delegate) - return false; - started_ = plugin_delegate->AddNetworkListObserver(this); + started_ = AddNetworkListObserver(this); return started_; } diff --git a/content/renderer/pepper/ppb_network_monitor_private_impl.h b/content/renderer/pepper/ppb_network_monitor_private_impl.h index 3a6b481..6e776f5 100644 --- a/content/renderer/pepper/ppb_network_monitor_private_impl.h +++ b/content/renderer/pepper/ppb_network_monitor_private_impl.h @@ -7,18 +7,18 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" +#include "content/renderer/p2p/network_list_observer.h" #include "content/renderer/pepper/plugin_delegate.h" #include "ppapi/c/private/ppb_network_monitor_private.h" #include "ppapi/shared_impl/resource.h" #include "ppapi/thunk/ppb_network_monitor_private_api.h" -#include "webkit/glue/network_list_observer.h" namespace content { class PPB_NetworkMonitor_Private_Impl : public ::ppapi::Resource, public ::ppapi::thunk::PPB_NetworkMonitor_Private_API, - public webkit_glue::NetworkListObserver { + public content::NetworkListObserver { public: static PP_Resource Create(PP_Instance instance, PPB_NetworkMonitor_Callback callback, diff --git a/content/renderer/pepper/ppb_scrollbar_impl.cc b/content/renderer/pepper/ppb_scrollbar_impl.cc index 9c6800a..d17a8ee 100644 --- a/content/renderer/pepper/ppb_scrollbar_impl.cc +++ b/content/renderer/pepper/ppb_scrollbar_impl.cc @@ -21,7 +21,6 @@ #include "third_party/WebKit/public/platform/WebVector.h" #include "third_party/WebKit/public/web/WebInputEvent.h" #include "third_party/WebKit/public/web/WebPluginScrollbar.h" -#include "webkit/glue/webkit_glue.h" #if defined(OS_WIN) #include "base/win/windows_version.h" diff --git a/content/renderer/pepper/ppb_uma_private_impl.cc b/content/renderer/pepper/ppb_uma_private_impl.cc index c3c66a50..ae9fe10 100644 --- a/content/renderer/pepper/ppb_uma_private_impl.cc +++ b/content/renderer/pepper/ppb_uma_private_impl.cc @@ -8,7 +8,6 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/private/ppb_uma_private.h" #include "ppapi/shared_impl/var.h" -#include "webkit/glue/webkit_glue.h" using ppapi::StringVar; |