Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Side by Side Diff: content/browser/accessibility/browser_accessibility_android.cc

Issue 1925473002: Add verbose logging for native accessibility events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@load_complete
Patch Set: address all feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_android.h" 5 #include "content/browser/accessibility/browser_accessibility_android.h"
6 6
7 #include "base/i18n/break_iterator.h" 7 #include "base/i18n/break_iterator.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 BrowserAccessibilityAndroid::BrowserAccessibilityAndroid() { 59 BrowserAccessibilityAndroid::BrowserAccessibilityAndroid() {
60 first_time_ = true; 60 first_time_ = true;
61 } 61 }
62 62
63 bool BrowserAccessibilityAndroid::IsNative() const { 63 bool BrowserAccessibilityAndroid::IsNative() const {
64 return true; 64 return true;
65 } 65 }
66 66
67 void BrowserAccessibilityAndroid::OnLocationChanged() { 67 void BrowserAccessibilityAndroid::OnLocationChanged() {
68 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_LOCATION_CHANGED, this); 68 manager()->NotifyAccessibilityEvent(
69 BrowserAccessibilityEvent::FromTreeChange,
70 ui::AX_EVENT_LOCATION_CHANGED,
71 this);
69 } 72 }
70 73
71 base::string16 BrowserAccessibilityAndroid::GetValue() const { 74 base::string16 BrowserAccessibilityAndroid::GetValue() const {
72 base::string16 value = BrowserAccessibility::GetValue(); 75 base::string16 value = BrowserAccessibility::GetValue();
73 76
74 // Optionally replace entered password text with bullet characters 77 // Optionally replace entered password text with bullet characters
75 // based on a user preference. 78 // based on a user preference.
76 if (IsPassword()) { 79 if (IsPassword()) {
77 bool should_expose = static_cast<BrowserAccessibilityManagerAndroid*>( 80 bool should_expose = static_cast<BrowserAccessibilityManagerAndroid*>(
78 manager())->ShouldExposePasswordText(); 81 manager())->ShouldExposePasswordText();
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 BrowserAccessibility::OnDataChanged(); 1369 BrowserAccessibility::OnDataChanged();
1367 1370
1368 if (IsEditableText()) { 1371 if (IsEditableText()) {
1369 base::string16 value = GetValue(); 1372 base::string16 value = GetValue();
1370 if (value != new_value_) { 1373 if (value != new_value_) {
1371 old_value_ = new_value_; 1374 old_value_ = new_value_;
1372 new_value_ = value; 1375 new_value_ = value;
1373 } 1376 }
1374 } 1377 }
1375 1378
1376 if (GetRole() == ui::AX_ROLE_ALERT && first_time_) 1379 if (GetRole() == ui::AX_ROLE_ALERT && first_time_) {
1377 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, this); 1380 manager()->NotifyAccessibilityEvent(
1381 BrowserAccessibilityEvent::FromTreeChange,
1382 ui::AX_EVENT_ALERT,
1383 this);
1384 }
1378 1385
1379 base::string16 live; 1386 base::string16 live;
1380 if (GetString16Attribute( 1387 if (GetString16Attribute(
1381 ui::AX_ATTR_CONTAINER_LIVE_STATUS, &live)) { 1388 ui::AX_ATTR_CONTAINER_LIVE_STATUS, &live)) {
1382 NotifyLiveRegionUpdate(live); 1389 NotifyLiveRegionUpdate(live);
1383 } 1390 }
1384 1391
1385 first_time_ = false; 1392 first_time_ = false;
1386 } 1393 }
1387 1394
1388 void BrowserAccessibilityAndroid::NotifyLiveRegionUpdate( 1395 void BrowserAccessibilityAndroid::NotifyLiveRegionUpdate(
1389 base::string16& aria_live) { 1396 base::string16& aria_live) {
1390 if (!base::EqualsASCII(aria_live, aria_strings::kAriaLivePolite) && 1397 if (!base::EqualsASCII(aria_live, aria_strings::kAriaLivePolite) &&
1391 !base::EqualsASCII(aria_live, aria_strings::kAriaLiveAssertive)) 1398 !base::EqualsASCII(aria_live, aria_strings::kAriaLiveAssertive))
1392 return; 1399 return;
1393 1400
1394 base::string16 text = GetText(); 1401 base::string16 text = GetText();
1395 if (cached_text_ != text) { 1402 if (cached_text_ != text) {
1396 if (!text.empty()) { 1403 if (!text.empty()) {
1397 manager()->NotifyAccessibilityEvent(ui::AX_EVENT_SHOW, 1404 manager()->NotifyAccessibilityEvent(
1398 this); 1405 BrowserAccessibilityEvent::FromTreeChange,
1406 ui::AX_EVENT_SHOW,
1407 this);
1399 } 1408 }
1400 cached_text_ = text; 1409 cached_text_ = text;
1401 } 1410 }
1402 } 1411 }
1403 1412
1404 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { 1413 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const {
1405 int count = 0; 1414 int count = 0;
1406 for (uint32_t i = 0; i < PlatformChildCount(); i++) { 1415 for (uint32_t i = 0; i < PlatformChildCount(); i++) {
1407 if (PlatformGetChild(i)->GetRole() == role) 1416 if (PlatformGetChild(i)->GetRole() == role)
1408 count++; 1417 count++;
1409 } 1418 }
1410 return count; 1419 return count;
1411 } 1420 }
1412 1421
1413 } // namespace content 1422 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility.cc ('k') | content/browser/accessibility/browser_accessibility_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698