Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: content/browser/browser_url_handler_impl.cc

Issue 105723002: Add the scheme chrome-distiller:// and hook up data source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments from jam@ Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_url_handler_impl.cc
diff --git a/content/browser/browser_url_handler_impl.cc b/content/browser/browser_url_handler_impl.cc
index fb657c0547b9c87e969cb4293e07878d6bbc6afd..7c212dc3fd6c80e07b66422aba47278c30fc73a6 100644
--- a/content/browser/browser_url_handler_impl.cc
+++ b/content/browser/browser_url_handler_impl.cc
@@ -23,15 +23,23 @@ static bool HandleViewSource(GURL* url, BrowserContext* browser_context) {
// Bug 26129: limit view-source to view the content and not any
// other kind of 'active' url scheme like 'javascript' or 'data'.
- static const char* const allowed_sub_schemes[] = {
+ static const char* const default_allowed_sub_schemes[] = {
kHttpScheme, kHttpsScheme, kFtpScheme,
chrome::kChromeDevToolsScheme, chrome::kChromeUIScheme,
kFileScheme, kFileSystemScheme
};
+ // Merge all the schemes for which view-source is allowed by default, with
+ // the WebUI schemes defined by the ContentBrowserClient.
+ std::vector<std::string> all_allowed_sub_schemes;
+ for (size_t i = 0; i < arraysize(default_allowed_sub_schemes); ++i)
+ all_allowed_sub_schemes.push_back(default_allowed_sub_schemes[i]);
+ GetContentClient()->browser()->GetAdditionalWebUISchemes(
+ &all_allowed_sub_schemes);
+
bool is_sub_scheme_allowed = false;
- for (size_t i = 0; i < arraysize(allowed_sub_schemes); i++) {
- if (url->SchemeIs(allowed_sub_schemes[i])) {
+ for (size_t i = 0; i < all_allowed_sub_schemes.size(); ++i) {
+ if (url->SchemeIs(all_allowed_sub_schemes[i].c_str())) {
is_sub_scheme_allowed = true;
break;
}
« no previous file with comments | « components/dom_distiller/webui/dom_distiller_handler.cc ('k') | content/browser/webui/url_data_manager_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698