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 "chrome/browser/ui/views/accessibility/accessibility_event_router_views
.h" | 5 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views
.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 void AccessibilityEventRouterViews::HandleAccessibilityEvent( | 44 void AccessibilityEventRouterViews::HandleAccessibilityEvent( |
45 views::View* view, ui::AXEvent event_type) { | 45 views::View* view, ui::AXEvent event_type) { |
46 if (!ExtensionAccessibilityEventRouter::GetInstance()-> | 46 if (!ExtensionAccessibilityEventRouter::GetInstance()-> |
47 IsAccessibilityEnabled()) { | 47 IsAccessibilityEnabled()) { |
48 return; | 48 return; |
49 } | 49 } |
50 | 50 |
51 if (event_type == ui::AX_EVENT_TEXT_CHANGED || | 51 if (event_type == ui::AX_EVENT_TEXT_CHANGED || |
52 event_type == ui::AX_EVENT_SELECTION_CHANGED) { | 52 event_type == ui::AX_EVENT_TEXT_SELECTION_CHANGED) { |
53 // These two events should only be sent for views that have focus. This | 53 // These two events should only be sent for views that have focus. This |
54 // enforces the invariant that we fire events triggered by user action and | 54 // enforces the invariant that we fire events triggered by user action and |
55 // not by programmatic logic. For example, the location bar can be updated | 55 // not by programmatic logic. For example, the location bar can be updated |
56 // by javascript while the user focus is within some other part of the | 56 // by javascript while the user focus is within some other part of the |
57 // user interface. In contrast, the other supported events here do not | 57 // user interface. In contrast, the other supported events here do not |
58 // depend on focus. For example, a menu within a menubar can open or close | 58 // depend on focus. For example, a menu within a menubar can open or close |
59 // while focus is within the location bar or anywhere else as a result of | 59 // while focus is within the location bar or anywhere else as a result of |
60 // user action. Note that the below logic can at some point be removed if | 60 // user action. Note that the below logic can at some point be removed if |
61 // we pass more information along to the listener such as focused state. | 61 // we pass more information along to the listener such as focused state. |
62 if (!view->GetFocusManager() || | 62 if (!view->GetFocusManager() || |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 return base::UTF16ToUTF8(state.name); | 545 return base::UTF16ToUTF8(state.name); |
546 | 546 |
547 for (int i = 0; i < view->child_count(); ++i) { | 547 for (int i = 0; i < view->child_count(); ++i) { |
548 views::View* child = view->child_at(i); | 548 views::View* child = view->child_at(i); |
549 std::string result = RecursiveGetStaticText(child); | 549 std::string result = RecursiveGetStaticText(child); |
550 if (!result.empty()) | 550 if (!result.empty()) |
551 return result; | 551 return result; |
552 } | 552 } |
553 return std::string(); | 553 return std::string(); |
554 } | 554 } |
OLD | NEW |