Chromium Code Reviews| 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..6bf283e36b032c245e4c95561e294bf49723d49c 100644 |
| --- a/content/browser/webui/web_ui_data_source_impl.cc |
| +++ b/content/browser/webui/web_ui_data_source_impl.cc |
| @@ -74,6 +74,9 @@ class WebUIDataSourceImpl::InternalDataSource : public URLDataSource { |
| bool ShouldDenyXFrameOptions() const override { |
| return parent_->deny_xframe_options_; |
| } |
| + bool IsGzipped(const std::string& path) const override { |
| + return parent_->use_gzip_for_all_paths_ && path != parent_->json_path_; |
|
smaier
2016/07/15 14:44:47
Why do we care if we match the json_path_ of the p
Dan Beam
2016/07/15 16:44:40
because things like string.js aren't gzipped
|
| + } |
| private: |
| WebUIDataSourceImpl* parent_; |
| @@ -88,7 +91,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 +183,10 @@ void WebUIDataSourceImpl::DisableDenyXFrameOptions() { |
| deny_xframe_options_ = false; |
| } |
| +void WebUIDataSourceImpl::UseGzipForAllPaths() { |
| + use_gzip_for_all_paths_ = true; |
| +} |
| + |
| std::string WebUIDataSourceImpl::GetSource() const { |
| return source_name_; |
| } |