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 #ifndef CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_FOCUS_ONLY_H_ | 5 #ifndef CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_FOCUS_ONLY_H_ |
6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_FOCUS_ONLY_H_ | 6 #define CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_FOCUS_ONLY_H_ |
7 | 7 |
8 #include "content/renderer/accessibility/renderer_accessibility.h" | 8 #include "content/renderer/accessibility/renderer_accessibility.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 // This is an accsessibility implementation that only handles whatever | 12 // This is an accessibility implementation that only handles whatever |
13 // node has focus, ignoring everything else. It's here because on Windows 8, | 13 // node has focus, ignoring everything else. It's here because on Windows 8, |
14 // we need to use accessibility APIs to tell the operating system when a | 14 // we need to use accessibility APIs to tell the operating system when a |
15 // touch should pop up the on-screen keyboard, but it's not worth the | 15 // touch should pop up the on-screen keyboard, but it's not worth the |
16 // performance overhead to enable full accessibility support. | 16 // performance overhead to enable full accessibility support. |
17 // | 17 // |
18 // Here's how the on-screen keyboard works in Windows 8 "Metro-style" apps: | 18 // Here's how the on-screen keyboard works in Windows 8 "Metro-style" apps: |
19 // | 19 // |
20 // 1. The user touches a control. | 20 // 1. The user touches a control. |
21 // 2. If the application determines focus moves to an editable text control, | 21 // 2. If the application determines focus moves to an editable text control, |
22 // it sends a native focus event, pointing to a native accessibility object | 22 // it sends a native focus event, pointing to a native accessibility object |
(...skipping 19 matching lines...) Expand all Loading... |
42 // | 42 // |
43 // Sometimes, touching an element other than a text box will result in a | 43 // Sometimes, touching an element other than a text box will result in a |
44 // text box getting focus. We want the on-screen keyboard to pop up in those | 44 // text box getting focus. We want the on-screen keyboard to pop up in those |
45 // cases, so we "cheat" more and always send the dimensions of the whole | 45 // cases, so we "cheat" more and always send the dimensions of the whole |
46 // window as the bounds of the child object. That way, a touch that leads | 46 // window as the bounds of the child object. That way, a touch that leads |
47 // to a text box getting focus will always open the on-screen keyboard, | 47 // to a text box getting focus will always open the on-screen keyboard, |
48 // regardless of the relation between the touch location and the text box | 48 // regardless of the relation between the touch location and the text box |
49 // bounds. | 49 // bounds. |
50 class RendererAccessibilityFocusOnly : public RendererAccessibility { | 50 class RendererAccessibilityFocusOnly : public RendererAccessibility { |
51 public: | 51 public: |
52 explicit RendererAccessibilityFocusOnly(RenderViewImpl* render_view); | 52 explicit RendererAccessibilityFocusOnly(RenderFrameImpl* render_frame); |
53 virtual ~RendererAccessibilityFocusOnly(); | 53 virtual ~RendererAccessibilityFocusOnly(); |
54 | 54 |
55 // RendererAccessibility implementation. | 55 // RendererAccessibility implementation. |
56 virtual void HandleWebAccessibilityEvent( | 56 virtual void HandleWebAccessibilityEvent( |
57 const blink::WebAXObject& obj, blink::WebAXEvent event) OVERRIDE; | 57 const blink::WebAXObject& obj, blink::WebAXEvent event) OVERRIDE; |
58 virtual RendererAccessibilityType GetType() OVERRIDE; | 58 virtual RendererAccessibilityType GetType() OVERRIDE; |
| 59 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE; |
59 | 60 |
60 // RenderView::Observer implementation. | 61 // RenderFrameObserver implementation. |
61 virtual void FocusedNodeChanged(const blink::WebNode& node) OVERRIDE; | 62 virtual void DidFinishLoad() OVERRIDE; |
62 virtual void DidFinishLoad(blink::WebLocalFrame* frame) OVERRIDE; | |
63 | 63 |
64 private: | 64 private: |
65 void HandleFocusedNodeChanged(const blink::WebNode& node, | 65 void HandleFocusedNodeChanged(const blink::WebNode& node, |
66 bool send_focus_event); | 66 bool send_focus_event); |
67 | 67 |
68 int next_id_; | 68 int next_id_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityFocusOnly); | 70 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityFocusOnly); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace content | 73 } // namespace content |
74 | 74 |
75 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_FOCUS_ONLY_H_ | 75 #endif // CONTENT_RENDERER_ACCESSIBILITY_RENDERER_ACCESSIBILITY_FOCUS_ONLY_H_ |
OLD | NEW |