diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 06:45:43 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 06:45:43 +0000 |
commit | 4e600d6a8369367459477f9845f86d4fce16f69e (patch) | |
tree | 5e01487537a1fbf7c3cae46c23d201d3e58332cf /chrome/browser/dom_ui | |
parent | b0544c44da65ac1a2b0654f97ec473c76176aea2 (diff) | |
download | chromium_src-4e600d6a8369367459477f9845f86d4fce16f69e.zip chromium_src-4e600d6a8369367459477f9845f86d4fce16f69e.tar.gz chromium_src-4e600d6a8369367459477f9845f86d4fce16f69e.tar.bz2 |
Refactor: Move the code that handles "chrome://net-internals/*" from the net module to the chrome module.
This is in preparation for making a javascript frontend to it, and merging in the functionality from about:network.
There is no behavior change here, just moving code around.
Review URL: http://codereview.chromium.org/668039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40608 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r-- | chrome/browser/dom_ui/chrome_url_data_manager.cc | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index 8a546127..d6b73ff 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -18,6 +18,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/net/chrome_url_request_context.h" +#include "chrome/browser/net/view_net_internals_job_factory.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/ref_counted_util.h" #include "chrome/common/url_constants.h" @@ -28,7 +29,6 @@ #include "net/url_request/url_request.h" #include "net/url_request/url_request_file_job.h" #include "net/url_request/url_request_job.h" -#include "net/url_request/url_request_view_net_internals_job.h" // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal @@ -306,34 +306,6 @@ void ChromeURLDataManager::DataSource::SetFontAndTextDirection( L"rtl" : L"ltr"); } -// This class describes how to form chrome://net-internals/DESCRIPTION -// URLs, and conversely how to extract DESCRIPTION. -// -// This needs to be passed to URLRequestViewNetInternalsJob, which lives -// in the network module and doesn't know anything about what URL protocol -// it has been registered with. -class NetInternalsURLFormat : public URLRequestViewNetInternalsJob::URLFormat { - public: - virtual std::string GetDetails(const GURL& url) { - DCHECK(IsSupportedURL(url)); - size_t start = strlen(chrome::kNetworkViewInternalsURL); - if (start >= url.spec().size()) - return std::string(); - return url.spec().substr(start); - } - - virtual GURL MakeURL(const std::string& details) { - return GURL(std::string(chrome::kNetworkViewInternalsURL) + details); - } - - static bool IsSupportedURL(const GURL& url) { - // Note that kNetworkViewInternalsURL is terminated by a '/'. - return StartsWithASCII(url.spec(), - chrome::kNetworkViewInternalsURL, - true /*case_sensitive*/); - } -}; - URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, const std::string& scheme) { // Try first with a file handler @@ -342,10 +314,8 @@ URLRequestJob* ChromeURLDataManager::Factory(URLRequest* request, return new URLRequestChromeFileJob(request, path); // Next check for chrome://net-internals/, which uses its own job type. - if (NetInternalsURLFormat::IsSupportedURL(request->url())) { - static NetInternalsURLFormat url_format; - return new URLRequestViewNetInternalsJob(request, &url_format); - } + if (ViewNetInternalsJobFactory::IsSupportedURL(request->url())) + return ViewNetInternalsJobFactory::CreateJobForRequest(request); // Fall back to using a custom handler return new URLRequestChromeJob(request); |