Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: content/browser/accessibility/accessibility_tree_formatter.cc

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_tree_formatter.h" 5 #include "content/browser/accessibility/accessibility_tree_formatter.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/browser/accessibility/browser_accessibility_manager.h" 13 #include "content/browser/accessibility/browser_accessibility_manager.h"
14 #include "content/browser/renderer_host/render_widget_host_view_base.h" 14 #include "content/browser/renderer_host/render_widget_host_view_base.h"
15 #include "content/public/browser/render_view_host.h" 15 #include "content/browser/web_contents/web_contents_impl.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 17
18 namespace content { 18 namespace content {
19 namespace { 19 namespace {
20 const int kIndentSpaces = 4; 20 const int kIndentSpaces = 4;
21 const char* kSkipString = "@NO_DUMP"; 21 const char* kSkipString = "@NO_DUMP";
22 const char* kChildrenDictAttr = "children"; 22 const char* kChildrenDictAttr = "children";
23 } 23 }
24 24
25 AccessibilityTreeFormatter::AccessibilityTreeFormatter( 25 AccessibilityTreeFormatter::AccessibilityTreeFormatter(
26 BrowserAccessibility* root) 26 BrowserAccessibility* root)
27 : root_(root) { 27 : root_(root) {
28 Initialize(); 28 Initialize();
29 } 29 }
30 30
31 // static 31 // static
32 AccessibilityTreeFormatter* AccessibilityTreeFormatter::Create( 32 AccessibilityTreeFormatter* AccessibilityTreeFormatter::Create(
33 RenderViewHost* rvh) { 33 WebContents* web_contents) {
34 RenderWidgetHostViewBase* host_view = static_cast<RenderWidgetHostViewBase*>(
35 WebContents::FromRenderViewHost(rvh)->GetRenderWidgetHostView());
36
37 BrowserAccessibilityManager* manager = 34 BrowserAccessibilityManager* manager =
38 host_view->GetBrowserAccessibilityManager(); 35 static_cast<WebContentsImpl*>(web_contents)->
36 GetRootBrowserAccessibilityManager();
39 if (!manager) 37 if (!manager)
40 return NULL; 38 return NULL;
41 39
42 BrowserAccessibility* root = manager->GetRoot(); 40 BrowserAccessibility* root = manager->GetRoot();
43 return new AccessibilityTreeFormatter(root); 41 return new AccessibilityTreeFormatter(root);
44 } 42 }
45 43
46 44
47 AccessibilityTreeFormatter::~AccessibilityTreeFormatter() { 45 AccessibilityTreeFormatter::~AccessibilityTreeFormatter() {
48 } 46 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (attr.empty()) 178 if (attr.empty())
181 return; 179 return;
182 if (!MatchesFilters(attr, include_by_default)) 180 if (!MatchesFilters(attr, include_by_default))
183 return; 181 return;
184 if (!line->empty()) 182 if (!line->empty())
185 *line += base::ASCIIToUTF16(" "); 183 *line += base::ASCIIToUTF16(" ");
186 *line += attr; 184 *line += attr;
187 } 185 }
188 186
189 } // namespace content 187 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/accessibility_tree_formatter.h ('k') | content/browser/accessibility/accessibility_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698