OLD | NEW |
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/renderer/accessibility/renderer_accessibility.h" | 5 #include "content/renderer/accessibility/renderer_accessibility.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
| 9 #include "content/renderer/render_frame_impl.h" |
9 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
10 #include "third_party/WebKit/public/web/WebAXObject.h" | 11 #include "third_party/WebKit/public/web/WebAXObject.h" |
11 #include "third_party/WebKit/public/web/WebDocument.h" | 12 #include "third_party/WebKit/public/web/WebDocument.h" |
12 #include "third_party/WebKit/public/web/WebFrame.h" | 13 #include "third_party/WebKit/public/web/WebFrame.h" |
13 #include "third_party/WebKit/public/web/WebView.h" | 14 #include "third_party/WebKit/public/web/WebView.h" |
14 | 15 |
15 using blink::WebAXObject; | 16 using blink::WebAXObject; |
16 using blink::WebDocument; | 17 using blink::WebDocument; |
17 using blink::WebFrame; | 18 using blink::WebFrame; |
18 using blink::WebView; | 19 using blink::WebView; |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 RendererAccessibility::RendererAccessibility( | 23 RendererAccessibility::RendererAccessibility( |
23 RenderViewImpl* render_view) | 24 RenderFrameImpl* render_frame) |
24 : RenderViewObserver(render_view), | 25 : RenderFrameObserver(render_frame), |
25 render_view_(render_view), | 26 render_frame_(render_frame), |
26 logging_(false) { | 27 logging_(false) { |
27 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 28 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
28 if (command_line.HasSwitch(switches::kEnableAccessibilityLogging)) | 29 if (command_line.HasSwitch(switches::kEnableAccessibilityLogging)) |
29 logging_ = true; | 30 logging_ = true; |
30 } | 31 } |
31 | 32 |
32 RendererAccessibility::~RendererAccessibility() { | 33 RendererAccessibility::~RendererAccessibility() { |
33 } | 34 } |
34 | 35 |
35 WebDocument RendererAccessibility::GetMainDocument() { | 36 WebDocument RendererAccessibility::GetMainDocument() { |
36 WebView* view = render_view()->GetWebView(); | 37 WebView* view = render_frame_->render_view()->GetWebView(); |
37 WebFrame* main_frame = view ? view->mainFrame() : NULL; | 38 WebFrame* main_frame = view ? view->mainFrame() : NULL; |
38 | 39 |
39 if (main_frame) | 40 if (main_frame) |
40 return main_frame->document(); | 41 return main_frame->document(); |
41 | 42 |
42 return WebDocument(); | 43 return WebDocument(); |
43 } | 44 } |
44 | 45 |
45 #ifndef NDEBUG | 46 #ifndef NDEBUG |
46 const std::string RendererAccessibility::AccessibilityEventToString( | 47 const std::string RendererAccessibility::AccessibilityEventToString( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 case ui::AX_EVENT_VALUE_CHANGED: | 116 case ui::AX_EVENT_VALUE_CHANGED: |
116 return "value changed"; | 117 return "value changed"; |
117 default: | 118 default: |
118 NOTREACHED(); | 119 NOTREACHED(); |
119 } | 120 } |
120 return ""; | 121 return ""; |
121 } | 122 } |
122 #endif | 123 #endif |
123 | 124 |
124 } // namespace content | 125 } // namespace content |
OLD | NEW |