Chromium Code Reviews| 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(); |