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

Unified Diff: content/browser/accessibility/accessibility_ui.cc

Issue 2399553002: Gzip compress chrome://accessibility resources (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | content/browser/webui/web_ui_data_source_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/accessibility_ui.cc
diff --git a/content/browser/accessibility/accessibility_ui.cc b/content/browser/accessibility/accessibility_ui.cc
index cf0db1142dd83d221b3149888007ff144c90a40f..6100767976d91bc192ba6e927fffdd5b8dbf117b 100644
--- a/content/browser/accessibility/accessibility_ui.cc
+++ b/content/browser/accessibility/accessibility_ui.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/json/json_writer.h"
+#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -19,6 +20,7 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/browser/webui/web_ui_data_source_impl.h"
#include "content/common/view_message_enums.h"
#include "content/grit/content_resources.h"
#include "content/public/browser/favicon_status.h"
@@ -138,12 +140,32 @@ bool HandleRequestCallback(BrowserContext* current_context,
return true;
}
+class AccessibilityDataSource : public WebUIDataSourceImpl {
+ public:
+ static AccessibilityDataSource* Create(const std::string& source_name) {
Dan Beam 2016/10/05 17:40:42 i had to do this because a super is ref-counted [
agrieve 2016/10/05 18:40:19 A bit annoying that you need to subclass for this
Dan Beam 2016/10/05 19:03:36 yeah, that might work. i could also just make a w
agrieve 2016/10/05 19:09:33 I'd be supportive of that once we need it (but we
Dan Beam 2016/10/12 04:32:30 so this won't work (I tried here[1]), because GET
+ return new AccessibilityDataSource(source_name);
+ }
+
+ protected:
+ AccessibilityDataSource(const std::string& source_name)
+ : WebUIDataSourceImpl(source_name) {}
+ ~AccessibilityDataSource() override {}
+
+ bool IsGzipped(const std::string& path) const override {
+ return WebUIDataSourceImpl::IsGzipped(path) && path != kDataFile;
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AccessibilityDataSource);
+};
+
} // namespace
+
AccessibilityUI::AccessibilityUI(WebUI* web_ui) : WebUIController(web_ui) {
// Set up the chrome://accessibility source.
WebUIDataSource* html_source =
- WebUIDataSource::Create(kChromeUIAccessibilityHost);
+ AccessibilityDataSource::Create(kChromeUIAccessibilityHost);
web_ui->RegisterMessageCallback(
"toggleAccessibility",
@@ -170,6 +192,7 @@ AccessibilityUI::AccessibilityUI(WebUI* web_ui) : WebUIController(web_ui) {
html_source->SetRequestFilter(
base::Bind(&HandleRequestCallback,
web_ui->GetWebContents()->GetBrowserContext()));
+ html_source->DisableI18nAndUseGzipForAllPaths();
BrowserContext* browser_context =
web_ui->GetWebContents()->GetBrowserContext();
« no previous file with comments | « no previous file | content/browser/webui/web_ui_data_source_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698