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/browser/accessibility/browser_accessibility_manager_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/win/scoped_comptr.h" | 8 #include "base/win/scoped_comptr.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 10 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 parent_hwnd_ = accessible_hwnd_->GetParent(); | 48 parent_hwnd_ = accessible_hwnd_->GetParent(); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 BrowserAccessibilityManagerWin::~BrowserAccessibilityManagerWin() { | 52 BrowserAccessibilityManagerWin::~BrowserAccessibilityManagerWin() { |
53 if (tracked_scroll_object_) { | 53 if (tracked_scroll_object_) { |
54 tracked_scroll_object_->Release(); | 54 tracked_scroll_object_->Release(); |
55 tracked_scroll_object_ = NULL; | 55 tracked_scroll_object_ = NULL; |
56 } | 56 } |
57 if (accessible_hwnd_) | 57 if (accessible_hwnd_) |
58 accessible_hwnd_->OnManagerDeleted(); | 58 accessible_hwnd_->OnManagerDeleted(this); |
59 } | 59 } |
60 | 60 |
61 // static | 61 // static |
62 ui::AXTreeUpdate BrowserAccessibilityManagerWin::GetEmptyDocument() { | 62 ui::AXTreeUpdate BrowserAccessibilityManagerWin::GetEmptyDocument() { |
63 ui::AXNodeData empty_document; | 63 ui::AXNodeData empty_document; |
64 empty_document.id = 0; | 64 empty_document.id = 0; |
65 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; | 65 empty_document.role = ui::AX_ROLE_ROOT_WEB_AREA; |
66 empty_document.state = | 66 empty_document.state = |
67 (1 << ui::AX_STATE_ENABLED) | | 67 (1 << ui::AX_STATE_ENABLED) | |
68 (1 << ui::AX_STATE_READ_ONLY) | | 68 (1 << ui::AX_STATE_READ_ONLY) | |
69 (1 << ui::AX_STATE_BUSY); | 69 (1 << ui::AX_STATE_BUSY); |
70 | 70 |
71 ui::AXTreeUpdate update; | 71 ui::AXTreeUpdate update; |
72 update.nodes.push_back(empty_document); | 72 update.nodes.push_back(empty_document); |
73 return update; | 73 return update; |
74 } | 74 } |
75 | 75 |
76 void BrowserAccessibilityManagerWin::SetAccessibleHWND( | 76 void BrowserAccessibilityManagerWin::SetAccessibleHWND( |
77 LegacyRenderWidgetHostHWND* accessible_hwnd) { | 77 LegacyRenderWidgetHostHWND* accessible_hwnd) { |
| 78 if (accessible_hwnd_) |
| 79 accessible_hwnd_->OnManagerDeleted(this); |
| 80 |
78 accessible_hwnd_ = accessible_hwnd; | 81 accessible_hwnd_ = accessible_hwnd; |
| 82 |
79 if (accessible_hwnd_) { | 83 if (accessible_hwnd_) { |
80 accessible_hwnd_->set_browser_accessibility_manager(this); | 84 accessible_hwnd_->set_browser_accessibility_manager(this); |
81 parent_hwnd_ = accessible_hwnd_->GetParent(); | 85 parent_hwnd_ = accessible_hwnd_->GetParent(); |
82 } | 86 } |
83 } | 87 } |
84 | 88 |
85 void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event, | 89 void BrowserAccessibilityManagerWin::MaybeCallNotifyWinEvent(DWORD event, |
86 LONG child_id) { | 90 LONG child_id) { |
87 // If on Win 7 and complete accessibility is enabled, use the fake child HWND | 91 // If on Win 7 and complete accessibility is enabled, use the fake child HWND |
88 // to use as the root of the accessibility tree. See comments above | 92 // to use as the root of the accessibility tree. See comments above |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // |parent_iaccessible_| are no longer valid either, since they were | 315 // |parent_iaccessible_| are no longer valid either, since they were |
312 // derived from AccessibleHWND. We don't have to restore them to | 316 // derived from AccessibleHWND. We don't have to restore them to |
313 // previous values, though, because this should only happen | 317 // previous values, though, because this should only happen |
314 // during the destruct sequence for this window. | 318 // during the destruct sequence for this window. |
315 accessible_hwnd_ = NULL; | 319 accessible_hwnd_ = NULL; |
316 parent_hwnd_ = NULL; | 320 parent_hwnd_ = NULL; |
317 parent_iaccessible_ = NULL; | 321 parent_iaccessible_ = NULL; |
318 } | 322 } |
319 | 323 |
320 } // namespace content | 324 } // namespace content |
OLD | NEW |