| 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_focus_only.h" | 5 #include "content/renderer/accessibility/renderer_accessibility_focus_only.h" |
| 6 | 6 |
| 7 #include "content/renderer/render_view_impl.h" | 7 #include "content/renderer/render_view_impl.h" |
| 8 #include "third_party/WebKit/public/web/WebDocument.h" | 8 #include "third_party/WebKit/public/web/WebDocument.h" |
| 9 #include "third_party/WebKit/public/web/WebElement.h" | 9 #include "third_party/WebKit/public/web/WebElement.h" |
| 10 #include "third_party/WebKit/public/web/WebFrame.h" | 10 #include "third_party/WebKit/public/web/WebFrame.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 RendererAccessibilityType RendererAccessibilityFocusOnly::GetType() { | 43 RendererAccessibilityType RendererAccessibilityFocusOnly::GetType() { |
| 44 return RendererAccessibilityTypeFocusOnly; | 44 return RendererAccessibilityTypeFocusOnly; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void RendererAccessibilityFocusOnly::FocusedNodeChanged(const WebNode& node) { | 47 void RendererAccessibilityFocusOnly::FocusedNodeChanged(const WebNode& node) { |
| 48 // Send the new accessible tree and post a native focus event. | 48 // Send the new accessible tree and post a native focus event. |
| 49 HandleFocusedNodeChanged(node, true); | 49 HandleFocusedNodeChanged(node, true); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void RendererAccessibilityFocusOnly::DidFinishLoad(blink::WebFrame* frame) { | 52 void RendererAccessibilityFocusOnly::DidFinishLoad( |
| 53 blink::WebLocalFrame* frame) { |
| 53 WebView* view = render_view()->GetWebView(); | 54 WebView* view = render_view()->GetWebView(); |
| 54 if (view->focusedFrame() != frame) | 55 if (view->focusedFrame() != frame) |
| 55 return; | 56 return; |
| 56 | 57 |
| 57 WebDocument document = frame->document(); | 58 WebDocument document = frame->document(); |
| 58 // Send an accessible tree to the browser, but do not post a native | 59 // Send an accessible tree to the browser, but do not post a native |
| 59 // focus event. This is important so that if focus is initially in an | 60 // focus event. This is important so that if focus is initially in an |
| 60 // editable text field, Windows will know to pop up the keyboard if the | 61 // editable text field, Windows will know to pop up the keyboard if the |
| 61 // user touches it and focus doesn't change. | 62 // user touches it and focus doesn't change. |
| 62 HandleFocusedNodeChanged(document.focusedElement(), false); | 63 HandleFocusedNodeChanged(document.focusedElement(), false); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 147 |
| 147 Send(new AccessibilityHostMsg_Events(routing_id(), events)); | 148 Send(new AccessibilityHostMsg_Events(routing_id(), events)); |
| 148 | 149 |
| 149 // Increment the id, wrap back when we get past a million. | 150 // Increment the id, wrap back when we get past a million. |
| 150 next_id_++; | 151 next_id_++; |
| 151 if (next_id_ > 1000000) | 152 if (next_id_ > 1000000) |
| 152 next_id_ = kInitialId; | 153 next_id_ = kInitialId; |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace content | 156 } // namespace content |
| OLD | NEW |