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

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

Issue 2149323003: Change the way that gzipped resources are loaded from resources.pak (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename Created 4 years, 4 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
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.h ('k') | content/public/browser/url_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 2c091282f99918187a41a59babd6507155453749..0b07bddf0043f85ecc50e78ef55699b85ba00dae 100644
--- a/content/browser/webui/web_ui_data_source_impl.cc
+++ b/content/browser/webui/web_ui_data_source_impl.cc
@@ -74,6 +74,11 @@ class WebUIDataSourceImpl::InternalDataSource : public URLDataSource {
bool ShouldDenyXFrameOptions() const override {
return parent_->deny_xframe_options_;
}
+ bool IsGzipped(const std::string& path) const override {
+ if (!parent_->json_path_.empty() && path == parent_->json_path_)
+ return false;
+ return parent_->use_gzip_for_all_paths_;
+ }
private:
WebUIDataSourceImpl* parent_;
@@ -88,7 +93,8 @@ WebUIDataSourceImpl::WebUIDataSourceImpl(const std::string& source_name)
frame_src_set_(false),
deny_xframe_options_(true),
add_load_time_data_defaults_(true),
- replace_existing_source_(true) {}
+ replace_existing_source_(true),
+ use_gzip_for_all_paths_(false) {}
WebUIDataSourceImpl::~WebUIDataSourceImpl() {
}
@@ -179,6 +185,10 @@ void WebUIDataSourceImpl::DisableDenyXFrameOptions() {
deny_xframe_options_ = false;
}
+void WebUIDataSourceImpl::DisableI18nAndUseGzipForAllPaths() {
+ use_gzip_for_all_paths_ = true;
+}
+
std::string WebUIDataSourceImpl::GetSource() const {
return source_name_;
}
@@ -240,8 +250,9 @@ void WebUIDataSourceImpl::StartDataRequest(
GetContentClient()->GetDataResourceBytes(resource_id));
// TODO(dschuyler): improve filtering of which resource to run template
- // expansion upon.
- if (GetMimeType(path) == "text/html") {
+ // expansion upon. TODO(dbeam): make a streaming filter that works on gzipped
+ // content.
+ if (GetMimeType(path) == "text/html" && !source()->IsGzipped(path)) {
std::string replaced = ui::ReplaceTemplateExpressions(
base::StringPiece(response->front_as<char>(), response->size()),
replacements_);
« no previous file with comments | « content/browser/webui/web_ui_data_source_impl.h ('k') | content/public/browser/url_data_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698