| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 std::string title; | 68 std::string title; |
| 69 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rvh); | 69 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(rvh); |
| 70 AccessibilityMode accessibility_mode = rwhi->accessibility_mode(); | 70 AccessibilityMode accessibility_mode = rwhi->accessibility_mode(); |
| 71 | 71 |
| 72 GURL url; | 72 GURL url; |
| 73 GURL favicon_url; | 73 GURL favicon_url; |
| 74 if (web_contents) { | 74 if (web_contents) { |
| 75 // TODO(nasko): Fix the following code to use a consistent set of data | 75 // TODO(nasko): Fix the following code to use a consistent set of data |
| 76 // across the URL, title, and favicon. | 76 // across the URL, title, and favicon. |
| 77 url = web_contents->GetURL(); | 77 url = web_contents->GetURL(); |
| 78 title = UTF16ToUTF8(web_contents->GetTitle()); | 78 title = base::UTF16ToUTF8(web_contents->GetTitle()); |
| 79 NavigationController& controller = web_contents->GetController(); | 79 NavigationController& controller = web_contents->GetController(); |
| 80 NavigationEntry* entry = controller.GetVisibleEntry(); | 80 NavigationEntry* entry = controller.GetVisibleEntry(); |
| 81 if (entry != NULL && entry->GetURL().is_valid()) | 81 if (entry != NULL && entry->GetURL().is_valid()) |
| 82 favicon_url = entry->GetFavicon().url; | 82 favicon_url = entry->GetFavicon().url; |
| 83 } | 83 } |
| 84 | 84 |
| 85 return BuildTargetDescriptor(url, | 85 return BuildTargetDescriptor(url, |
| 86 title, | 86 title, |
| 87 favicon_url, | 87 favicon_url, |
| 88 rvh->GetProcess()->GetID(), | 88 rvh->GetProcess()->GetID(), |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 BrowserAccessibilityManager* manager = | 237 BrowserAccessibilityManager* manager = |
| 238 host_view->GetBrowserAccessibilityManager(); | 238 host_view->GetBrowserAccessibilityManager(); |
| 239 if (!manager) { | 239 if (!manager) { |
| 240 result->Set("error", | 240 result->Set("error", |
| 241 new base::StringValue("Could not get accessibility tree.")); | 241 new base::StringValue("Could not get accessibility tree.")); |
| 242 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); | 242 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 std::vector<AccessibilityTreeFormatter::Filter> filters; | 245 std::vector<AccessibilityTreeFormatter::Filter> filters; |
| 246 filters.push_back(AccessibilityTreeFormatter::Filter( | 246 filters.push_back(AccessibilityTreeFormatter::Filter( |
| 247 ASCIIToUTF16("*"), | 247 base::ASCIIToUTF16("*"), |
| 248 AccessibilityTreeFormatter::Filter::ALLOW)); | 248 AccessibilityTreeFormatter::Filter::ALLOW)); |
| 249 formatter->SetFilters(filters); | 249 formatter->SetFilters(filters); |
| 250 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); | 250 formatter->FormatAccessibilityTree(&accessibility_contents_utf16); |
| 251 | 251 |
| 252 result->Set("tree", | 252 result->Set("tree", |
| 253 new base::StringValue(UTF16ToUTF8(accessibility_contents_utf16))); | 253 new base::StringValue( |
| 254 base::UTF16ToUTF8(accessibility_contents_utf16))); |
| 254 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); | 255 web_ui()->CallJavascriptFunction("accessibility.showTree", *(result.get())); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace content | 258 } // namespace content |
| OLD | NEW |