From 390a6fda73369e447569efb1e8a7622460307d22 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Wed, 3 Dec 2014 15:34:09 +0100 Subject: Update Chromium to version 40.0.2214.28 and ninja to 1.5.3. * scoped_refptr operator for implicit conversion to pointer has been disabled upstream: https://codereview.chromium.org/510323002 * Group permission API as done upstream: https://codereview.chromium.org/622793002 * content_worker gyp target has been removed upstream. * GetPageThumbnailData moved to DevToolsManagerDelegate. * ui/ui_resources has been renamed to ui/resources * WebPreferences and ResourceType have moved inside content. * Merge ResourceBundle's InitSharedInstanceLocaleOnly with InitSharedInstanceWithLocale(): https://codereview.chromium.org/457103003 * Remove obsolete accessibility events. * AX_EVENT_SELECTED_TEXT_CHANGED has been renamed to AX_EVENT_TEXT_SELECTION_CHANGED * AX_ROLE_MATH_ELEMENT was removed upstream. https://codereview.chromium.org/695133002 * Screen::IsDIPEnabled has been removed upstream. https://codereview.chromium.org/672823002 * Update DevToolsHttpHandlerDelegateQt according to ShellDevToolsManagerDelegate. * Various functionality from DevToolsHttpHandler was moved to DevToolsManagerDelegate https://codereview.chromium.org/560323005 * DevToolsHttpHandler::Start expects a scoped_ptr now. * Make sure event_factory_evdev.h is not included when USE_OZONE is not defined * ErrorPageParams was moved into namespace error_page. * Media Access is now handled by ContentBrowserClient::CheckMediaAccessPermission * SpecialStoragePolicy moved to namespace storage * Add implementation for new pure virtual function BrowserContext::GetSSLHostStateDelegate. * RenderPass::Id was renamed to RenderPass::RenderPassId * Include view_messages.h for ViewHostMsg_TextInputState_Param * CERT_UNABLE_TO_CHECK_REVOCATION has been deprecated by Chromium: https://codereview.chromium.org/449743002 * MailboxManager::ConsumeTexture only takes the mailbox as an argument * Replace RWHVQt::TextInputStateChanged with RWHVQt::TextInputTypeChanged. * RenderWidgetHostView::ScrollOffsetChanged has been removed. * SkBitmap::Config was removed upstream. * CopyFromCompositingSurfaceCallback has become an own type. * AcceleratedSurfaceInitialized only takes route_id as an argument. * ServerBoundCertService has been renamed to ChannelIDService. Related API has been renamed accordingly. * TextureImageTransportSurface was removed upstream. * Update MediaCaptureDispatcher::OnMediaRequestStateChanged signature. * AudioStream related functions are gone upstream. https://codereview.chromium.org/569713002 * Add implementation for RenderWidgetHostViewQt::GetLastScrollOffset. * Include generic touch_device implementation. * switches::kDisableDesktopNotifications was removed upstream. https://codereview.chromium.org/607843002 * PageTransition moved to ui. * Messages headers are not guarded. Including them multiple times does hurt. * ScaleGestureDetector does not create a standalone GestureDetector anymore. https://codereview.chromium.org/501503003 * MotionEvent::Cancel and Clone are not virtual anymore. https://codereview.chromium.org/502993004 * Exclude os_exchange_data_provider_mac from build. * Remove argument from ScopedClipboardWriter ctor. https://codereview.chromium.org/558913003 * Remove ShowPopupMenu override from WebContentsQt. The function is not pure virtual anymore, and we never implemented any specifics. * Do not use clang on desktop linux. * Request functions in ContentBrowserClient were merged into RequestPermission. * ninja: use configure.py --bootstrap instead of bootstrap.py Change-Id: I3575612826db7845461a949b4e737264bb4e8d88 Reviewed-by: Pierre Rossi --- src/core/dev_tools_http_handler_delegate_qt.cpp | 75 +++++++++++-------------- 1 file changed, 33 insertions(+), 42 deletions(-) (limited to 'src/core/dev_tools_http_handler_delegate_qt.cpp') diff --git a/src/core/dev_tools_http_handler_delegate_qt.cpp b/src/core/dev_tools_http_handler_delegate_qt.cpp index 1bb8ec1f1..ba3e6d5b1 100644 --- a/src/core/dev_tools_http_handler_delegate_qt.cpp +++ b/src/core/dev_tools_http_handler_delegate_qt.cpp @@ -57,7 +57,7 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/content_switches.h" #include "net/socket/stream_listen_socket.h" -#include "net/socket/tcp_listen_socket.h" +#include "net/socket/tcp_server_socket.h" using namespace content; @@ -65,28 +65,40 @@ namespace { const char kTargetTypePage[] = "page"; +class TCPServerSocketFactory + : public DevToolsHttpHandler::ServerSocketFactory { +public: + TCPServerSocketFactory(const std::string& address, int port, int backlog) + : DevToolsHttpHandler::ServerSocketFactory(address, port, backlog) {} +private: + scoped_ptr Create() const override { + return scoped_ptr(new net::TCPServerSocket(NULL, net::NetLog::Source())); + } + DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); +}; + class Target : public content::DevToolsTarget { public: explicit Target(WebContents* web_contents); - virtual std::string GetId() const OVERRIDE { return id_; } - virtual std::string GetParentId() const OVERRIDE { return std::string(); } - virtual std::string GetType() const OVERRIDE { return kTargetTypePage; } - virtual std::string GetTitle() const OVERRIDE { return title_; } - virtual std::string GetDescription() const OVERRIDE { return std::string(); } - virtual GURL GetURL() const OVERRIDE { return url_; } - virtual GURL GetFaviconURL() const OVERRIDE { return favicon_url_; } - virtual base::TimeTicks GetLastActivityTime() const OVERRIDE { + virtual std::string GetId() const override { return id_; } + virtual std::string GetParentId() const override { return std::string(); } + virtual std::string GetType() const override { return kTargetTypePage; } + virtual std::string GetTitle() const override { return title_; } + virtual std::string GetDescription() const override { return std::string(); } + virtual GURL GetURL() const override { return url_; } + virtual GURL GetFaviconURL() const override { return favicon_url_; } + virtual base::TimeTicks GetLastActivityTime() const override { return last_activity_time_; } - virtual bool IsAttached() const OVERRIDE { + virtual bool IsAttached() const override { return agent_host_->IsAttached(); } - virtual scoped_refptr GetAgentHost() const OVERRIDE { + virtual scoped_refptr GetAgentHost() const override { return agent_host_; } - virtual bool Activate() const OVERRIDE; - virtual bool Close() const OVERRIDE; + virtual bool Activate() const override; + virtual bool Close() const override; private: scoped_refptr agent_host_; @@ -98,7 +110,7 @@ private: }; Target::Target(WebContents* web_contents) { - agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents->GetRenderViewHost()); + agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents); id_ = agent_host_->GetId(); title_ = base::UTF16ToUTF8(web_contents->GetTitle()); url_ = web_contents->GetURL(); @@ -110,10 +122,7 @@ Target::Target(WebContents* web_contents) { } bool Target::Activate() const { - RenderViewHost* rvh = agent_host_->GetRenderViewHost(); - if (!rvh) - return false; - WebContents* web_contents = WebContents::FromRenderViewHost(rvh); + WebContents *web_contents = agent_host_->GetWebContents(); if (!web_contents) return false; web_contents->GetDelegate()->ActivateContents(web_contents); @@ -121,7 +130,10 @@ bool Target::Activate() const { } bool Target::Close() const { - RenderViewHost* rvh = agent_host_->GetRenderViewHost(); + WebContents *web_contents = agent_host_->GetWebContents(); + if (!web_contents) + return false; + RenderViewHost* rvh = web_contents->GetRenderViewHost(); if (!rvh) return false; rvh->ClosePage(); @@ -143,7 +155,8 @@ DevToolsHttpHandlerDelegateQt::DevToolsHttpHandlerDelegateQt(BrowserContext* bro if (base::StringToInt(portString, &portInt) && portInt > 0 && portInt < 65535) listeningPort = portInt; } - m_devtoolsHttpHandler = DevToolsHttpHandler::Start(new net::TCPListenSocketFactory("0.0.0.0", listeningPort), std::string(), this, base::FilePath()); + scoped_ptr factory(new TCPServerSocketFactory("0.0.0.0", listeningPort, 1)); + m_devtoolsHttpHandler = DevToolsHttpHandler::Start(factory.Pass(), std::string(), this, base::FilePath()); } DevToolsHttpHandlerDelegateQt::~DevToolsHttpHandlerDelegateQt() @@ -173,28 +186,6 @@ base::FilePath DevToolsHttpHandlerDelegateQt::GetDebugFrontendDir() return base::FilePath(); } -std::string DevToolsHttpHandlerDelegateQt::GetPageThumbnailData(const GURL& url) -{ - return std::string(); -} - -scoped_ptr DevToolsHttpHandlerDelegateQt::CreateNewTarget(const GURL&) -{ - return scoped_ptr(); -} - -void DevToolsHttpHandlerDelegateQt::EnumerateTargets(TargetCallback callback) -{ - TargetList targets; - std::vector rvh_list = content::DevToolsAgentHost::GetValidRenderViewHosts(); - for (std::vector::iterator it = rvh_list.begin(); it != rvh_list.end(); ++it) { - WebContents* web_contents = WebContents::FromRenderViewHost(*it); - if (web_contents) - targets.push_back(new Target(web_contents)); - } - callback.Run(targets); -} - scoped_ptr DevToolsHttpHandlerDelegateQt::CreateSocketForTethering(net::StreamListenSocket::Delegate* delegate, std::string* name) { return scoped_ptr(); -- cgit v1.2.3