summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornyquist@chromium.org <nyquist@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-31 22:49:46 +0000
committernyquist@chromium.org <nyquist@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-31 22:49:46 +0000
commit9cb6c306a5910d195ad3c05a154ca15c32f27e05 (patch)
tree3a5f060960d61f2184202f08f6716aa6582a7696
parent56c87e8f06f71487477e0b43003f1c624fd57f37 (diff)
downloadchromium_src-9cb6c306a5910d195ad3c05a154ca15c32f27e05.zip
chromium_src-9cb6c306a5910d195ad3c05a154ca15c32f27e05.tar.gz
chromium_src-9cb6c306a5910d195ad3c05a154ca15c32f27e05.tar.bz2
Fix scheme-based URLDataSource lookup.
The result of content::URLDataSource::GetSource() is used as a key to the content::URLDataManagerBackend for when looking up sources. Previously, this has always been the hostname of the URL used to access the data source, but after r247187 landed, this source name was also used for a scheme (chrome-distiller://). This CL adds a requirement for the source name to include "://" as a suffix for the return value from GetSource() for scheme-based sources, so for chrome-distiller it becomes "chrome-distiller://". BUG=338997 Review URL: https://codereview.chromium.org/135273013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248295 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--components/dom_distiller/content/dom_distiller_viewer_source.cc4
-rw-r--r--content/browser/webui/url_data_manager_backend.cc2
-rw-r--r--content/public/browser/url_data_source.h6
3 files changed, 9 insertions, 3 deletions
diff --git a/components/dom_distiller/content/dom_distiller_viewer_source.cc b/components/dom_distiller/content/dom_distiller_viewer_source.cc
index ec1751d..2f23a07 100644
--- a/components/dom_distiller/content/dom_distiller_viewer_source.cc
+++ b/components/dom_distiller/content/dom_distiller_viewer_source.cc
@@ -102,7 +102,9 @@ DomDistillerViewerSource::DomDistillerViewerSource(
DomDistillerViewerSource::~DomDistillerViewerSource() {}
-std::string DomDistillerViewerSource::GetSource() const { return scheme_; }
+std::string DomDistillerViewerSource::GetSource() const {
+ return scheme_ + "://";
+}
void DomDistillerViewerSource::StartDataRequest(
const std::string& path,
diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc
index e830066..10d518b 100644
--- a/content/browser/webui/url_data_manager_backend.cc
+++ b/content/browser/webui/url_data_manager_backend.cc
@@ -580,7 +580,7 @@ URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL(
// No match using the host of the URL, so do a lookup using the scheme for
// URLs on the form source_name://extra_bits/foo .
- i = data_sources_.find(url.scheme());
+ i = data_sources_.find(url.scheme() + "://");
if (i != data_sources_.end())
return i->second.get();
diff --git a/content/public/browser/url_data_source.h b/content/public/browser/url_data_source.h
index af395cf..33c185b 100644
--- a/content/public/browser/url_data_source.h
+++ b/content/public/browser/url_data_source.h
@@ -36,7 +36,11 @@ class CONTENT_EXPORT URLDataSource {
// The name of this source.
// E.g., for favicons, this could be "favicon", which results in paths for
- // specific resources like "favicon/34" getting sent to this source.
+ // specific resources like "favicon/34" getting sent to this source. For
+ // sources where a scheme is used instead of the hostname as the unique
+ // identifier, the suffix "://" must be added to the return value, eg. for a
+ // URLDataSource which would display resources with URLs on the form
+ // your-scheme://anything , GetSource() must return "your-scheme://".
virtual std::string GetSource() const = 0;
// Used by StartDataRequest so that the child class can return the data when