| Index: content/browser/webui/url_data_manager_backend.cc
|
| diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc
|
| index 8290b79ec1e112796f6db58c9ba4cc66309ac052..5e14f62943a4cdc7d6fd3f6fadbcf54d01c39111 100644
|
| --- a/content/browser/webui/url_data_manager_backend.cc
|
| +++ b/content/browser/webui/url_data_manager_backend.cc
|
| @@ -22,6 +22,7 @@
|
| #include "content/browser/webui/shared_resources_data_source.h"
|
| #include "content/browser/webui/url_data_source_impl.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "content/public/browser/content_browser_client.h"
|
| #include "content/public/common/url_constants.h"
|
| #include "googleurl/src/url_util.h"
|
| #include "net/base/io_buffer.h"
|
| @@ -43,12 +44,20 @@ const char kChromeURLContentSecurityPolicyHeaderBase[] =
|
|
|
| const char kChromeURLXFrameOptionsHeader[] = "X-Frame-Options: DENY";
|
|
|
| +bool SchemeIsInSchemes(const std::string& scheme,
|
| + const std::vector<std::string>& schemes) {
|
| + return std::find(schemes.begin(), schemes.end(), scheme) != schemes.end();
|
| +}
|
| +
|
| // Parse a URL into the components used to resolve its request. |source_name|
|
| // is the hostname and |path| is the remaining portion of the URL.
|
| void URLToRequest(const GURL& url, std::string* source_name,
|
| std::string* path) {
|
| DCHECK(url.SchemeIs(chrome::kChromeDevToolsScheme) ||
|
| - url.SchemeIs(chrome::kChromeUIScheme));
|
| + url.SchemeIs(chrome::kChromeUIScheme) ||
|
| + SchemeIsInSchemes(
|
| + url.scheme(),
|
| + GetContentClient()->browser()->GetAdditionalWebUISchemes()));
|
|
|
| if (!url.is_valid()) {
|
| NOTREACHED();
|
| @@ -304,7 +313,7 @@ void URLRequestChromeJob::StartAsync() {
|
| if (!request_)
|
| return;
|
|
|
| - if (!backend_->StartRequest(request_->url(), this)) {
|
| + if (!backend_->StartRequest(request_, this)) {
|
| NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
|
| net::ERR_INVALID_URL));
|
| }
|
| @@ -417,12 +426,12 @@ bool URLDataManagerBackend::HasPendingJob(
|
| return false;
|
| }
|
|
|
| -bool URLDataManagerBackend::StartRequest(const GURL& url,
|
| +bool URLDataManagerBackend::StartRequest(const net::URLRequest* request,
|
| URLRequestChromeJob* job) {
|
| // Parse the URL into a request for a source and path.
|
| std::string source_name;
|
| std::string path;
|
| - URLToRequest(url, &source_name, &path);
|
| + URLToRequest(request->url(), &source_name, &path);
|
|
|
| // Look up the data source for the request.
|
| DataSourceMap::iterator i = data_sources_.find(source_name);
|
| @@ -431,6 +440,9 @@ bool URLDataManagerBackend::StartRequest(const GURL& url,
|
|
|
| URLDataSourceImpl* source = i->second;
|
|
|
| + if (!source->source()->ShouldServiceRequest(request))
|
| + return false;
|
| +
|
| // Save this request so we know where to send the data.
|
| RequestID request_id = next_request_id_++;
|
| pending_requests_.insert(std::make_pair(request_id, job));
|
|
|