OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/accessibility/accessibility_ui.h" | 5 #include "content/browser/accessibility/accessibility_ui.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 base::Unretained(this))); | 197 base::Unretained(this))); |
198 | 198 |
199 // Add required resources. | 199 // Add required resources. |
200 html_source->SetJsonPath("strings.js"); | 200 html_source->SetJsonPath("strings.js"); |
201 html_source->AddResourcePath("accessibility.css", IDR_ACCESSIBILITY_CSS); | 201 html_source->AddResourcePath("accessibility.css", IDR_ACCESSIBILITY_CSS); |
202 html_source->AddResourcePath("accessibility.js", IDR_ACCESSIBILITY_JS); | 202 html_source->AddResourcePath("accessibility.js", IDR_ACCESSIBILITY_JS); |
203 html_source->SetDefaultResource(IDR_ACCESSIBILITY_HTML); | 203 html_source->SetDefaultResource(IDR_ACCESSIBILITY_HTML); |
204 html_source->SetRequestFilter( | 204 html_source->SetRequestFilter( |
205 base::Bind(&HandleRequestCallback, | 205 base::Bind(&HandleRequestCallback, |
206 web_ui->GetWebContents()->GetBrowserContext())); | 206 web_ui->GetWebContents()->GetBrowserContext())); |
207 html_source->DisableI18nAndUseGzipForAllPaths(); | 207 |
208 html_source->ExcludePathFromGzip(kDataFile); | 208 std::unordered_set<std::string> exclude_from_gzip; |
| 209 exclude_from_gzip.insert(kDataFile); |
| 210 html_source->UseGzip(exclude_from_gzip); |
209 | 211 |
210 BrowserContext* browser_context = | 212 BrowserContext* browser_context = |
211 web_ui->GetWebContents()->GetBrowserContext(); | 213 web_ui->GetWebContents()->GetBrowserContext(); |
212 WebUIDataSource::Add(browser_context, html_source); | 214 WebUIDataSource::Add(browser_context, html_source); |
213 } | 215 } |
214 | 216 |
215 AccessibilityUI::~AccessibilityUI() {} | 217 AccessibilityUI::~AccessibilityUI() {} |
216 | 218 |
217 void AccessibilityUI::ToggleAccessibility(const base::ListValue* args) { | 219 void AccessibilityUI::ToggleAccessibility(const base::ListValue* args) { |
218 std::string process_id_str; | 220 std::string process_id_str; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), | 335 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), |
334 &accessibility_contents_utf16); | 336 &accessibility_contents_utf16); |
335 result->Set("tree", | 337 result->Set("tree", |
336 new base::StringValue( | 338 new base::StringValue( |
337 base::UTF16ToUTF8(accessibility_contents_utf16))); | 339 base::UTF16ToUTF8(accessibility_contents_utf16))); |
338 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", | 340 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", |
339 *(result.get())); | 341 *(result.get())); |
340 } | 342 } |
341 | 343 |
342 } // namespace content | 344 } // namespace content |
OLD | NEW |