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

Side by Side Diff: content/renderer/accessibility/blink_ax_tree_source.cc

Issue 273423004: Migrate accessibility from RenderView to RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more compile errors Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/accessibility/blink_ax_tree_source.h" 5 #include "content/renderer/accessibility/blink_ax_tree_source.h"
6 6
7 #include <set> 7 #include <set>
8 8
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/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "content/renderer/accessibility/blink_ax_enum_conversion.h" 12 #include "content/renderer/accessibility/blink_ax_enum_conversion.h"
13 #include "content/renderer/render_frame_impl.h"
13 #include "content/renderer/render_view_impl.h" 14 #include "content/renderer/render_view_impl.h"
14 #include "third_party/WebKit/public/platform/WebRect.h" 15 #include "third_party/WebKit/public/platform/WebRect.h"
15 #include "third_party/WebKit/public/platform/WebSize.h" 16 #include "third_party/WebKit/public/platform/WebSize.h"
16 #include "third_party/WebKit/public/platform/WebString.h" 17 #include "third_party/WebKit/public/platform/WebString.h"
17 #include "third_party/WebKit/public/platform/WebVector.h" 18 #include "third_party/WebKit/public/platform/WebVector.h"
18 #include "third_party/WebKit/public/web/WebAXEnums.h" 19 #include "third_party/WebKit/public/web/WebAXEnums.h"
19 #include "third_party/WebKit/public/web/WebAXObject.h" 20 #include "third_party/WebKit/public/web/WebAXObject.h"
20 #include "third_party/WebKit/public/web/WebDocument.h" 21 #include "third_party/WebKit/public/web/WebDocument.h"
21 #include "third_party/WebKit/public/web/WebDocumentType.h" 22 #include "third_party/WebKit/public/web/WebDocumentType.h"
22 #include "third_party/WebKit/public/web/WebElement.h" 23 #include "third_party/WebKit/public/web/WebElement.h"
23 #include "third_party/WebKit/public/web/WebFormControlElement.h" 24 #include "third_party/WebKit/public/web/WebFormControlElement.h"
24 #include "third_party/WebKit/public/web/WebInputElement.h" 25 #include "third_party/WebKit/public/web/WebInputElement.h"
25 #include "third_party/WebKit/public/web/WebLocalFrame.h" 26 #include "third_party/WebKit/public/web/WebLocalFrame.h"
26 #include "third_party/WebKit/public/web/WebNode.h" 27 #include "third_party/WebKit/public/web/WebNode.h"
27 #include "third_party/WebKit/public/web/WebView.h" 28 #include "third_party/WebKit/public/web/WebView.h"
28 29
29 using base::ASCIIToUTF16; 30 using base::ASCIIToUTF16;
30 using base::UTF16ToUTF8; 31 using base::UTF16ToUTF8;
31 using blink::WebAXObject; 32 using blink::WebAXObject;
32 using blink::WebDocument; 33 using blink::WebDocument;
33 using blink::WebDocumentType; 34 using blink::WebDocumentType;
34 using blink::WebElement; 35 using blink::WebElement;
36 using blink::WebFrame;
35 using blink::WebLocalFrame; 37 using blink::WebLocalFrame;
36 using blink::WebNode; 38 using blink::WebNode;
37 using blink::WebVector; 39 using blink::WebVector;
38 using blink::WebView; 40 using blink::WebView;
39 41
40 namespace content { 42 namespace content {
41 43
42 namespace { 44 namespace {
43 45
44 // Returns true if |ancestor| is the first unignored parent of |child|, 46 // Returns true if |ancestor| is the first unignored parent of |child|,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 ui::AXNodeData* dst) { 88 ui::AXNodeData* dst) {
87 std::vector<int32> ids; 89 std::vector<int32> ids;
88 for(size_t i = 0; i < objects.size(); i++) 90 for(size_t i = 0; i < objects.size(); i++)
89 ids.push_back(objects[i].axID()); 91 ids.push_back(objects[i].axID());
90 if (ids.size() > 0) 92 if (ids.size() > 0)
91 dst->AddIntListAttribute(attr, ids); 93 dst->AddIntListAttribute(attr, ids);
92 } 94 }
93 95
94 } // Anonymous namespace 96 } // Anonymous namespace
95 97
96 BlinkAXTreeSource::BlinkAXTreeSource(RenderViewImpl* render_view) 98 BlinkAXTreeSource::BlinkAXTreeSource(RenderFrameImpl* render_frame)
97 : render_view_(render_view) { 99 : render_frame_(render_frame) {
98 } 100 }
99 101
100 BlinkAXTreeSource::~BlinkAXTreeSource() { 102 BlinkAXTreeSource::~BlinkAXTreeSource() {
101 } 103 }
102 104
103 blink::WebAXObject BlinkAXTreeSource::GetRoot() const { 105 blink::WebAXObject BlinkAXTreeSource::GetRoot() const {
104 return GetMainDocument().accessibilityObject(); 106 return GetMainDocument().accessibilityObject();
105 } 107 }
106 108
107 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const { 109 blink::WebAXObject BlinkAXTreeSource::GetFromId(int32 id) const {
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 AddIntListAttributeFromWebObjects( 535 AddIntListAttributeFromWebObjects(
534 ui::AX_ATTR_LABELLEDBY_IDS, labelledby, dst); 536 ui::AX_ATTR_LABELLEDBY_IDS, labelledby, dst);
535 } 537 }
536 538
537 WebVector<WebAXObject> owns; 539 WebVector<WebAXObject> owns;
538 if (src.ariaOwns(owns)) 540 if (src.ariaOwns(owns))
539 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst); 541 AddIntListAttributeFromWebObjects(ui::AX_ATTR_OWNS_IDS, owns, dst);
540 } 542 }
541 543
542 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const { 544 blink::WebDocument BlinkAXTreeSource::GetMainDocument() const {
543 WebView* view = render_view_->GetWebView(); 545 WebView* view = render_frame_->render_view()->GetWebView();
544 WebLocalFrame* main_frame = 546 WebFrame* main_frame = view ? view->mainFrame() : NULL;
545 view ? view->mainFrame()->toWebLocalFrame() : NULL;
546 547
547 if (main_frame) 548 if (main_frame)
548 return main_frame->document(); 549 return main_frame->document();
549
550 return WebDocument(); 550 return WebDocument();
551 } 551 }
552 552
553 } // namespace content 553 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698