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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 // static | 337 // static |
338 void AccessibilityEventRouterViews::SendTextfieldNotification( | 338 void AccessibilityEventRouterViews::SendTextfieldNotification( |
339 views::View* view, | 339 views::View* view, |
340 ui::AXEvent event, | 340 ui::AXEvent event, |
341 Profile* profile) { | 341 Profile* profile) { |
342 ui::AXViewState state; | 342 ui::AXViewState state; |
343 view->GetAccessibleState(&state); | 343 view->GetAccessibleState(&state); |
344 std::string name = base::UTF16ToUTF8(state.name); | 344 std::string name = base::UTF16ToUTF8(state.name); |
345 std::string context = GetViewContext(view); | 345 std::string context = GetViewContext(view); |
346 bool password = | 346 bool password = state.HasStateFlag(ui::AX_STATE_PROTECTED); |
347 (state.state & ui::AX_STATE_PROTECTED) != 0; | |
348 AccessibilityTextBoxInfo info(profile, name, context, password); | 347 AccessibilityTextBoxInfo info(profile, name, context, password); |
349 std::string value = base::UTF16ToUTF8(state.value); | 348 std::string value = base::UTF16ToUTF8(state.value); |
350 info.SetValue(value, state.selection_start, state.selection_end); | 349 info.SetValue(value, state.selection_start, state.selection_end); |
351 SendControlAccessibilityNotification(event, &info); | 350 SendControlAccessibilityNotification(event, &info); |
352 } | 351 } |
353 | 352 |
354 // static | 353 // static |
355 void AccessibilityEventRouterViews::SendComboboxNotification( | 354 void AccessibilityEventRouterViews::SendComboboxNotification( |
356 views::View* view, | 355 views::View* view, |
357 ui::AXEvent event, | 356 ui::AXEvent event, |
(...skipping 14 matching lines...) Expand all Loading... |
372 ui::AXEvent event, | 371 ui::AXEvent event, |
373 Profile* profile) { | 372 Profile* profile) { |
374 ui::AXViewState state; | 373 ui::AXViewState state; |
375 view->GetAccessibleState(&state); | 374 view->GetAccessibleState(&state); |
376 std::string name = base::UTF16ToUTF8(state.name); | 375 std::string name = base::UTF16ToUTF8(state.name); |
377 std::string context = GetViewContext(view); | 376 std::string context = GetViewContext(view); |
378 AccessibilityCheckboxInfo info( | 377 AccessibilityCheckboxInfo info( |
379 profile, | 378 profile, |
380 name, | 379 name, |
381 context, | 380 context, |
382 state.state == ui::AX_STATE_CHECKED); | 381 state.HasStateFlag(ui::AX_STATE_CHECKED)); |
383 SendControlAccessibilityNotification(event, &info); | 382 SendControlAccessibilityNotification(event, &info); |
384 } | 383 } |
385 | 384 |
386 // static | 385 // static |
387 void AccessibilityEventRouterViews::SendWindowNotification( | 386 void AccessibilityEventRouterViews::SendWindowNotification( |
388 views::View* view, | 387 views::View* view, |
389 ui::AXEvent event, | 388 ui::AXEvent event, |
390 Profile* profile) { | 389 Profile* profile) { |
391 ui::AXViewState state; | 390 ui::AXViewState state; |
392 view->GetAccessibleState(&state); | 391 view->GetAccessibleState(&state); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 return base::UTF16ToUTF8(state.name); | 540 return base::UTF16ToUTF8(state.name); |
542 | 541 |
543 for (int i = 0; i < view->child_count(); ++i) { | 542 for (int i = 0; i < view->child_count(); ++i) { |
544 views::View* child = view->child_at(i); | 543 views::View* child = view->child_at(i); |
545 std::string result = RecursiveGetStaticText(child); | 544 std::string result = RecursiveGetStaticText(child); |
546 if (!result.empty()) | 545 if (!result.empty()) |
547 return result; | 546 return result; |
548 } | 547 } |
549 return std::string(); | 548 return std::string(); |
550 } | 549 } |
OLD | NEW |