diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 18:16:16 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-29 18:16:16 +0000 |
commit | 0d6672a5a92bce75004f4f2b97922760266df992 (patch) | |
tree | fee9371db625c2a029d0c59d5ddabee28960f7b9 | |
parent | 248006c7964f7f9ac8f6ed5c0f9658d309c170ae (diff) | |
download | chromium_src-0d6672a5a92bce75004f4f2b97922760266df992.zip chromium_src-0d6672a5a92bce75004f4f2b97922760266df992.tar.gz chromium_src-0d6672a5a92bce75004f4f2b97922760266df992.tar.bz2 |
DevTools: use proper URLRequestContextGetter in remote debugging proxy.
Review URL: https://chromiumcodereview.appspot.com/9911014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129648 0039d316-1c4b-4281-b951-d872f2087c98
9 files changed, 27 insertions, 29 deletions
diff --git a/chrome/browser/debugger/browser_list_tabcontents_provider.cc b/chrome/browser/debugger/browser_list_tabcontents_provider.cc index fbd2d77..303144b 100644 --- a/chrome/browser/debugger/browser_list_tabcontents_provider.cc +++ b/chrome/browser/debugger/browser_list_tabcontents_provider.cc @@ -43,13 +43,6 @@ std::string BrowserListTabContentsProvider::GetDiscoveryPageHTML() { IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); } -net::URLRequestContext* -BrowserListTabContentsProvider::GetURLRequestContext() { - net::URLRequestContextGetter* getter = - Profile::Deprecated::GetDefaultRequestContext(); - return getter ? getter->GetURLRequestContext() : NULL; -} - bool BrowserListTabContentsProvider::BundlesFrontendResources() { // We'd like front-end to be served from the WebUI via proxy, hence // pretend we don't have it bundled. diff --git a/chrome/browser/debugger/browser_list_tabcontents_provider.h b/chrome/browser/debugger/browser_list_tabcontents_provider.h index 58d149f..ce150ea 100644 --- a/chrome/browser/debugger/browser_list_tabcontents_provider.h +++ b/chrome/browser/debugger/browser_list_tabcontents_provider.h @@ -24,7 +24,6 @@ class BrowserListTabContentsProvider // DevToolsHttpProtocolHandler::Delegate overrides. virtual std::string GetDiscoveryPageHTML() OVERRIDE; - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; virtual bool BundlesFrontendResources() OVERRIDE; virtual std::string GetFrontendResourcesBaseURL() OVERRIDE; diff --git a/chrome/browser/debugger/remote_debugging_server.cc b/chrome/browser/debugger/remote_debugging_server.cc index ab002bd..0094e7e 100644 --- a/chrome/browser/debugger/remote_debugging_server.cc +++ b/chrome/browser/debugger/remote_debugging_server.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -17,10 +17,13 @@ RemoteDebuggingServer::RemoteDebuggingServer(Profile* profile, // Initialize DevTools data source. DevToolsUI::RegisterDevToolsDataSource(profile); + net::URLRequestContextGetter* request_context_getter = + profile->GetRequestContext(); devtools_http_handler_ = content::DevToolsHttpHandler::Start(ip, port, frontend_url, + request_context_getter, new BrowserListTabContentsProvider()); } diff --git a/content/browser/debugger/devtools_http_handler_impl.cc b/content/browser/debugger/devtools_http_handler_impl.cc index cb0bbb2..4daa330 100644 --- a/content/browser/debugger/devtools_http_handler_impl.cc +++ b/content/browser/debugger/devtools_http_handler_impl.cc @@ -36,6 +36,7 @@ #include "net/base/io_buffer.h" #include "net/server/http_server_request_info.h" #include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_getter.h" namespace content { @@ -98,9 +99,14 @@ DevToolsHttpHandler* DevToolsHttpHandler::Start( const std::string& ip, int port, const std::string& frontend_url, + net::URLRequestContextGetter* request_context_getter, DevToolsHttpHandlerDelegate* delegate) { DevToolsHttpHandlerImpl* http_handler = - new DevToolsHttpHandlerImpl(ip, port, frontend_url, delegate); + new DevToolsHttpHandlerImpl(ip, + port, + frontend_url, + request_context_getter, + delegate); http_handler->Start(); return http_handler; } @@ -167,7 +173,8 @@ void DevToolsHttpHandlerImpl::OnHttpRequest( } // Proxy static files from chrome-devtools://devtools/*. - net::URLRequestContext* request_context = delegate_->GetURLRequestContext(); + net::URLRequestContext* request_context = + request_context_getter_->GetURLRequestContext(); if (!request_context) { server_->Send404(connection_id); return; @@ -493,10 +500,12 @@ DevToolsHttpHandlerImpl::DevToolsHttpHandlerImpl( const std::string& ip, int port, const std::string& frontend_url, + net::URLRequestContextGetter* request_context_getter, DevToolsHttpHandlerDelegate* delegate) : ip_(ip), port_(port), overridden_frontend_url_(frontend_url), + request_context_getter_(request_context_getter), delegate_(delegate) { if (overridden_frontend_url_.empty()) overridden_frontend_url_ = "/devtools/devtools.html"; diff --git a/content/browser/debugger/devtools_http_handler_impl.h b/content/browser/debugger/devtools_http_handler_impl.h index 67f91ea..30148a4 100644 --- a/content/browser/debugger/devtools_http_handler_impl.h +++ b/content/browser/debugger/devtools_http_handler_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -19,7 +19,7 @@ #include "net/url_request/url_request.h" namespace net { -class URLRequestContext; +class URLRequestContextGetter; } namespace content { @@ -43,6 +43,7 @@ class DevToolsHttpHandlerImpl DevToolsHttpHandlerImpl(const std::string& ip, int port, const std::string& frontend_url, + net::URLRequestContextGetter* request_context_getter, DevToolsHttpHandlerDelegate* delegate); virtual ~DevToolsHttpHandlerImpl(); void Start(); @@ -108,6 +109,7 @@ class DevToolsHttpHandlerImpl typedef std::map<int, content::DevToolsClientHost*> ConnectionToClientHostMap; ConnectionToClientHostMap connection_to_client_host_ui_; + net::URLRequestContextGetter* request_context_getter_; scoped_ptr<DevToolsHttpHandlerDelegate> delegate_; typedef std::pair<int, int> Target; std::vector<Target> targets_; diff --git a/content/public/browser/devtools_http_handler.h b/content/public/browser/devtools_http_handler.h index cd394f3..73b91e7 100644 --- a/content/public/browser/devtools_http_handler.h +++ b/content/public/browser/devtools_http_handler.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -10,6 +10,10 @@ #include "content/common/content_export.h" +namespace net { +class URLRequestContextGetter; +} + namespace content { class DevToolsHttpHandlerDelegate; @@ -28,6 +32,7 @@ class DevToolsHttpHandler { const std::string& ip, int port, const std::string& frontend_url, + net::URLRequestContextGetter* request_context_getter, DevToolsHttpHandlerDelegate* delegate); // Called from the main thread in order to stop protocol handler. diff --git a/content/public/browser/devtools_http_handler_delegate.h b/content/public/browser/devtools_http_handler_delegate.h index e0f9f5f..0d58702 100644 --- a/content/public/browser/devtools_http_handler_delegate.h +++ b/content/public/browser/devtools_http_handler_delegate.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -9,10 +9,6 @@ #include <string> #include <vector> -namespace net { -class URLRequestContext; -} - namespace content { class WebContents; @@ -26,10 +22,6 @@ class DevToolsHttpHandlerDelegate { // and provide attach links. Called on the IO thread. virtual std::string GetDiscoveryPageHTML() = 0; - // Should return URL request context for issuing requests against devtools - // webui or NULL if no context is available. Called on the IO thread. - virtual net::URLRequestContext* GetURLRequestContext() = 0; - // Returns true if and only if frontend resources are bundled. virtual bool BundlesFrontendResources() = 0; diff --git a/content/shell/shell_devtools_delegate.cc b/content/shell/shell_devtools_delegate.cc index b16777c..15cdce8 100644 --- a/content/shell/shell_devtools_delegate.cc +++ b/content/shell/shell_devtools_delegate.cc @@ -21,6 +21,7 @@ ShellDevToolsDelegate::ShellDevToolsDelegate( "127.0.0.1", port, "", + context_getter_, this); } @@ -37,11 +38,6 @@ std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); } -net::URLRequestContext* -ShellDevToolsDelegate::GetURLRequestContext() { - return context_getter_->GetURLRequestContext(); -} - bool ShellDevToolsDelegate::BundlesFrontendResources() { return true; } diff --git a/content/shell/shell_devtools_delegate.h b/content/shell/shell_devtools_delegate.h index 2f37439..36f2af3 100644 --- a/content/shell/shell_devtools_delegate.h +++ b/content/shell/shell_devtools_delegate.h @@ -30,7 +30,6 @@ class ShellDevToolsDelegate : public content::DevToolsHttpHandlerDelegate { // DevToolsHttpProtocolHandler::Delegate overrides. virtual std::string GetDiscoveryPageHTML() OVERRIDE; - virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE; virtual bool BundlesFrontendResources() OVERRIDE; virtual std::string GetFrontendResourcesBaseURL() OVERRIDE; |