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

Unified Diff: content/browser/webui/web_ui_data_source_impl.cc

Issue 2590793004: MD Downloads: gzip vulcanized resources via compress="gzip" (Closed)
Patch Set: . Created 4 years 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
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.h ('k') | content/public/browser/web_ui_data_source.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/web_ui_data_source_impl.cc
diff --git a/content/browser/webui/web_ui_data_source_impl.cc b/content/browser/webui/web_ui_data_source_impl.cc
index e923236b94696e343d18a0eb596a5afe995f9675..a5751c48b657911be3f0694b0974dd12ebeade55 100644
--- a/content/browser/webui/web_ui_data_source_impl.cc
+++ b/content/browser/webui/web_ui_data_source_impl.cc
@@ -88,7 +88,7 @@ class WebUIDataSourceImpl::InternalDataSource : public URLDataSource {
return parent_->deny_xframe_options_;
}
bool IsGzipped(const std::string& path) const override {
- return parent_->use_gzip_for_all_paths_ &&
+ return parent_->use_gzip_ &&
parent_->excluded_paths_.find(path) == parent_->excluded_paths_.end();
}
@@ -107,7 +107,7 @@ WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name)
deny_xframe_options_(true),
add_load_time_data_defaults_(true),
replace_existing_source_(true),
- use_gzip_for_all_paths_(false) {}
+ use_gzip_(false) {}
WebUIDataSourceImpl::~WebUIDataSourceImpl() {
}
@@ -165,7 +165,7 @@ void WebUIDataSourceImpl::SetJsonPath(const std::string& path) {
DCHECK(!path.empty());
json_path_ = path;
- ExcludePathFromGzip(json_path_);
+ excluded_paths_.insert(json_path_);
}
void WebUIDataSourceImpl::AddResourcePath(const std::string &path,
@@ -186,10 +186,6 @@ void WebUIDataSourceImpl::DisableReplaceExistingSource() {
replace_existing_source_ = false;
}
-void WebUIDataSourceImpl::ExcludePathFromGzip(const std::string& path) {
- excluded_paths_.insert(path);
-}
-
bool WebUIDataSourceImpl::IsWebUIDataSourceImpl() const {
return true;
}
@@ -220,8 +216,11 @@ void WebUIDataSourceImpl::DisableDenyXFrameOptions() {
deny_xframe_options_ = false;
}
-void WebUIDataSourceImpl::DisableI18nAndUseGzipForAllPaths() {
- use_gzip_for_all_paths_ = true;
+void WebUIDataSourceImpl::UseGzip(
+ const std::unordered_set<std::string>& excluded_paths) {
+ use_gzip_ = true;
+ for (const auto& path : excluded_paths)
+ excluded_paths_.insert(path);
}
const ui::TemplateReplacements* WebUIDataSourceImpl::GetReplacements() const {
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.h ('k') | content/public/browser/web_ui_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698