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 html_source->UseGzipForAllPaths(); |
208 html_source->ExcludePathFromGzip(kDataFile); | 208 html_source->ExcludePathFromGzip(kDataFile); |
209 | 209 |
210 BrowserContext* browser_context = | 210 BrowserContext* browser_context = |
211 web_ui->GetWebContents()->GetBrowserContext(); | 211 web_ui->GetWebContents()->GetBrowserContext(); |
212 WebUIDataSource::Add(browser_context, html_source); | 212 WebUIDataSource::Add(browser_context, html_source); |
213 } | 213 } |
214 | 214 |
215 AccessibilityUI::~AccessibilityUI() {} | 215 AccessibilityUI::~AccessibilityUI() {} |
216 | 216 |
217 void AccessibilityUI::ToggleAccessibility(const base::ListValue* args) { | 217 void AccessibilityUI::ToggleAccessibility(const base::ListValue* args) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), | 333 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), |
334 &accessibility_contents_utf16); | 334 &accessibility_contents_utf16); |
335 result->Set("tree", | 335 result->Set("tree", |
336 new base::StringValue( | 336 new base::StringValue( |
337 base::UTF16ToUTF8(accessibility_contents_utf16))); | 337 base::UTF16ToUTF8(accessibility_contents_utf16))); |
338 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", | 338 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", |
339 *(result.get())); | 339 *(result.get())); |
340 } | 340 } |
341 | 341 |
342 } // namespace content | 342 } // namespace content |
OLD | NEW |