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.h" | 10 #include "base/message_loop.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return; | 78 return; |
79 } | 79 } |
80 | 80 |
81 // Don't dispatch the accessibility event until the next time through the | 81 // Don't dispatch the accessibility event until the next time through the |
82 // event loop, to handle cases where the view's state changes after | 82 // event loop, to handle cases where the view's state changes after |
83 // the call to post the event. It's safe to use base::Unretained(this) | 83 // the call to post the event. It's safe to use base::Unretained(this) |
84 // because AccessibilityEventRouterViews is a singleton. | 84 // because AccessibilityEventRouterViews is a singleton. |
85 views::ViewStorage* view_storage = views::ViewStorage::GetInstance(); | 85 views::ViewStorage* view_storage = views::ViewStorage::GetInstance(); |
86 int view_storage_id = view_storage->CreateStorageID(); | 86 int view_storage_id = view_storage->CreateStorageID(); |
87 view_storage->StoreView(view_storage_id, view); | 87 view_storage->StoreView(view_storage_id, view); |
88 MessageLoop::current()->PostTask( | 88 base::MessageLoop::current()->PostTask( |
89 FROM_HERE, | 89 FROM_HERE, |
90 base::Bind( | 90 base::Bind( |
91 &AccessibilityEventRouterViews::DispatchNotificationOnViewStorageId, | 91 &AccessibilityEventRouterViews::DispatchNotificationOnViewStorageId, |
92 view_storage_id, | 92 view_storage_id, |
93 notification_type)); | 93 notification_type)); |
94 } | 94 } |
95 | 95 |
96 void AccessibilityEventRouterViews::HandleMenuItemFocused( | 96 void AccessibilityEventRouterViews::HandleMenuItemFocused( |
97 const string16& menu_name, | 97 const string16& menu_name, |
98 const string16& menu_item_name, | 98 const string16& menu_item_name, |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 return UTF16ToUTF8(state.name); | 486 return UTF16ToUTF8(state.name); |
487 | 487 |
488 for (int i = 0; i < view->child_count(); ++i) { | 488 for (int i = 0; i < view->child_count(); ++i) { |
489 views::View* child = view->child_at(i); | 489 views::View* child = view->child_at(i); |
490 std::string result = RecursiveGetStaticText(child); | 490 std::string result = RecursiveGetStaticText(child); |
491 if (!result.empty()) | 491 if (!result.empty()) |
492 return result; | 492 return result; |
493 } | 493 } |
494 return std::string(); | 494 return std::string(); |
495 } | 495 } |
OLD | NEW |