| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 base::Unretained(this))); | 163 base::Unretained(this))); |
| 164 | 164 |
| 165 // Add required resources. | 165 // Add required resources. |
| 166 html_source->SetJsonPath("strings.js"); | 166 html_source->SetJsonPath("strings.js"); |
| 167 html_source->AddResourcePath("accessibility.css", IDR_ACCESSIBILITY_CSS); | 167 html_source->AddResourcePath("accessibility.css", IDR_ACCESSIBILITY_CSS); |
| 168 html_source->AddResourcePath("accessibility.js", IDR_ACCESSIBILITY_JS); | 168 html_source->AddResourcePath("accessibility.js", IDR_ACCESSIBILITY_JS); |
| 169 html_source->SetDefaultResource(IDR_ACCESSIBILITY_HTML); | 169 html_source->SetDefaultResource(IDR_ACCESSIBILITY_HTML); |
| 170 html_source->SetRequestFilter( | 170 html_source->SetRequestFilter( |
| 171 base::Bind(&HandleRequestCallback, | 171 base::Bind(&HandleRequestCallback, |
| 172 web_ui->GetWebContents()->GetBrowserContext())); | 172 web_ui->GetWebContents()->GetBrowserContext())); |
| 173 html_source->DisableI18nAndUseGzipForAllPaths(); |
| 173 | 174 |
| 174 BrowserContext* browser_context = | 175 BrowserContext* browser_context = |
| 175 web_ui->GetWebContents()->GetBrowserContext(); | 176 web_ui->GetWebContents()->GetBrowserContext(); |
| 176 WebUIDataSource::Add(browser_context, html_source); | 177 WebUIDataSource::Add(browser_context, html_source); |
| 177 } | 178 } |
| 178 | 179 |
| 179 AccessibilityUI::~AccessibilityUI() {} | 180 AccessibilityUI::~AccessibilityUI() {} |
| 180 | 181 |
| 181 void AccessibilityUI::ToggleAccessibility(const base::ListValue* args) { | 182 void AccessibilityUI::ToggleAccessibility(const base::ListValue* args) { |
| 182 std::string process_id_str; | 183 std::string process_id_str; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), | 258 web_contents->GetRootBrowserAccessibilityManager()->GetRoot(), |
| 258 &accessibility_contents_utf16); | 259 &accessibility_contents_utf16); |
| 259 result->Set("tree", | 260 result->Set("tree", |
| 260 new base::StringValue( | 261 new base::StringValue( |
| 261 base::UTF16ToUTF8(accessibility_contents_utf16))); | 262 base::UTF16ToUTF8(accessibility_contents_utf16))); |
| 262 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", | 263 web_ui()->CallJavascriptFunctionUnsafe("accessibility.showTree", |
| 263 *(result.get())); | 264 *(result.get())); |
| 264 } | 265 } |
| 265 | 266 |
| 266 } // namespace content | 267 } // namespace content |
| OLD | NEW |