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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_mac.mm

Issue 2811713006: Fire event on Mac when PRESSED state changes (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager_mac.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_mac.h" 5 #include "content/browser/accessibility/browser_accessibility_manager_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 while (i < old_text.length() && i < new_text.length() && 398 while (i < old_text.length() && i < new_text.length() &&
399 old_text[i] == new_text[i]) { 399 old_text[i] == new_text[i]) {
400 ++i; 400 ++i;
401 } 401 }
402 size_t length = (old_text.length() - i) - (new_text.length() - i); 402 size_t length = (old_text.length() - i) - (new_text.length() - i);
403 base::string16 deleted_text = old_text.substr(i, length); 403 base::string16 deleted_text = old_text.substr(i, length);
404 text_edits_[new_node_data.id] = deleted_text; 404 text_edits_[new_node_data.id] = deleted_text;
405 } 405 }
406 } 406 }
407 407
408 void BrowserAccessibilityManagerMac::OnStateChanged(ui::AXTree* tree,
409 ui::AXNode* ax_node,
410 ui::AXState state,
411 bool new_value) {
412 if (state != ui::AX_STATE_PRESSED)
413 return;
414
415 BrowserAccessibility* node = GetFromID(ax_node->id());
416 NotifyAccessibilityEvent(BrowserAccessibilityEvent::FromTreeChange,
417 ui::AX_EVENT_CHECKED_STATE_CHANGED, node);
418 }
419
408 NSDictionary* BrowserAccessibilityManagerMac:: 420 NSDictionary* BrowserAccessibilityManagerMac::
409 GetUserInfoForSelectedTextChangedNotification() { 421 GetUserInfoForSelectedTextChangedNotification() {
410 NSMutableDictionary* user_info = [[[NSMutableDictionary alloc] init] 422 NSMutableDictionary* user_info = [[[NSMutableDictionary alloc] init]
411 autorelease]; 423 autorelease];
412 [user_info setObject:@YES forKey:NSAccessibilityTextStateSyncKey]; 424 [user_info setObject:@YES forKey:NSAccessibilityTextStateSyncKey];
413 [user_info setObject:@(AXTextStateChangeTypeUnknown) 425 [user_info setObject:@(AXTextStateChangeTypeUnknown)
414 forKey:NSAccessibilityTextStateChangeTypeKey]; 426 forKey:NSAccessibilityTextStateChangeTypeKey];
415 [user_info setObject:@(AXTextSelectionDirectionUnknown) 427 [user_info setObject:@(AXTextSelectionDirectionUnknown)
416 forKey:NSAccessibilityTextSelectionDirection]; 428 forKey:NSAccessibilityTextSelectionDirection];
417 [user_info setObject:@(AXTextSelectionGranularityUnknown) 429 [user_info setObject:@(AXTextSelectionGranularityUnknown)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 NSAccessibilityTextChangeValues : changes, 480 NSAccessibilityTextChangeValues : changes,
469 NSAccessibilityTextChangeElement : native_node 481 NSAccessibilityTextChangeElement : native_node
470 }; 482 };
471 } 483 }
472 484
473 NSView* BrowserAccessibilityManagerMac::GetParentView() { 485 NSView* BrowserAccessibilityManagerMac::GetParentView() {
474 return delegate() ? delegate()->AccessibilityGetAcceleratedWidget() : nullptr; 486 return delegate() ? delegate()->AccessibilityGetAcceleratedWidget() : nullptr;
475 } 487 }
476 488
477 } // namespace content 489 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_manager_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698