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

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

Issue 2271653006: base::mac::IsOSSierra() -> base::mac::IsOS10_12(), etc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Nits Created 4 years, 3 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 | « components/handoff/handoff_manager.mm ('k') | content/browser/bootstrap_sandbox_manager_mac.cc » ('j') | 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 #import "base/mac/mac_util.h" 7 #import "base/mac/mac_util.h"
8 #import "base/mac/sdk_forward_declarations.h" 8 #import "base/mac/sdk_forward_declarations.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 break; 206 break;
207 case ui::AX_EVENT_DOCUMENT_SELECTION_CHANGED: { 207 case ui::AX_EVENT_DOCUMENT_SELECTION_CHANGED: {
208 mac_notification = NSAccessibilitySelectedTextChangedNotification; 208 mac_notification = NSAccessibilitySelectedTextChangedNotification;
209 // WebKit fires a notification both on the focused object and the root. 209 // WebKit fires a notification both on the focused object and the root.
210 BrowserAccessibility* focus = GetFocus(); 210 BrowserAccessibility* focus = GetFocus();
211 if (!focus) 211 if (!focus)
212 break; // Just fire a notification on the root. 212 break; // Just fire a notification on the root.
213 NSAccessibilityPostNotification(ToBrowserAccessibilityCocoa(focus), 213 NSAccessibilityPostNotification(ToBrowserAccessibilityCocoa(focus),
214 mac_notification); 214 mac_notification);
215 215
216 if (base::mac::IsOSElCapitanOrLater()) { 216 if (base::mac::IsAtLeastOS10_11()) {
217 // |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X 217 // |NSAccessibilityPostNotificationWithUserInfo| should be used on OS X
218 // 10.11 or later to notify Voiceover about text selection changes. This 218 // 10.11 or later to notify Voiceover about text selection changes. This
219 // API has been present on versions of OS X since 10.7 but doesn't 219 // API has been present on versions of OS X since 10.7 but doesn't
220 // appear to be needed by Voiceover before version 10.11. 220 // appear to be needed by Voiceover before version 10.11.
221 NSDictionary* user_info = 221 NSDictionary* user_info =
222 GetUserInfoForSelectedTextChangedNotification(); 222 GetUserInfoForSelectedTextChangedNotification();
223 223
224 BrowserAccessibility* root = GetRoot(); 224 BrowserAccessibility* root = GetRoot();
225 if (!root) 225 if (!root)
226 return; 226 return;
227 227
228 NSAccessibilityPostNotificationWithUserInfo( 228 NSAccessibilityPostNotificationWithUserInfo(
229 ToBrowserAccessibilityCocoa(focus), mac_notification, user_info); 229 ToBrowserAccessibilityCocoa(focus), mac_notification, user_info);
230 NSAccessibilityPostNotificationWithUserInfo( 230 NSAccessibilityPostNotificationWithUserInfo(
231 ToBrowserAccessibilityCocoa(root), mac_notification, user_info); 231 ToBrowserAccessibilityCocoa(root), mac_notification, user_info);
232 return; 232 return;
233 } 233 }
234 break; 234 break;
235 } 235 }
236 case ui::AX_EVENT_CHECKED_STATE_CHANGED: 236 case ui::AX_EVENT_CHECKED_STATE_CHANGED:
237 mac_notification = NSAccessibilityValueChangedNotification; 237 mac_notification = NSAccessibilityValueChangedNotification;
238 break; 238 break;
239 case ui::AX_EVENT_VALUE_CHANGED: 239 case ui::AX_EVENT_VALUE_CHANGED:
240 mac_notification = NSAccessibilityValueChangedNotification; 240 mac_notification = NSAccessibilityValueChangedNotification;
241 if (base::mac::IsOSElCapitanOrLater() && text_edits_.size()) { 241 if (base::mac::IsAtLeastOS10_11() && text_edits_.size()) {
242 // It seems that we don't need to distinguish between deleted and 242 // It seems that we don't need to distinguish between deleted and
243 // inserted text for now. 243 // inserted text for now.
244 base::string16 deleted_text; 244 base::string16 deleted_text;
245 base::string16 inserted_text; 245 base::string16 inserted_text;
246 int32_t id = node->GetId(); 246 int32_t id = node->GetId();
247 const auto iterator = text_edits_.find(id); 247 const auto iterator = text_edits_.find(id);
248 if (iterator != text_edits_.end()) 248 if (iterator != text_edits_.end())
249 inserted_text = iterator->second; 249 inserted_text = iterator->second;
250 NSDictionary* user_info = GetUserInfoForValueChangedNotification( 250 NSDictionary* user_info = GetUserInfoForValueChangedNotification(
251 native_node, deleted_text, inserted_text); 251 native_node, deleted_text, inserted_text);
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 466
467 return @{ 467 return @{
468 NSAccessibilityTextStateChangeTypeKey : @(AXTextStateChangeTypeEdit), 468 NSAccessibilityTextStateChangeTypeKey : @(AXTextStateChangeTypeEdit),
469 NSAccessibilityTextChangeValues : changes, 469 NSAccessibilityTextChangeValues : changes,
470 NSAccessibilityTextChangeElement : native_node 470 NSAccessibilityTextChangeElement : native_node
471 }; 471 };
472 } 472 }
473 473
474 } // namespace content 474 } // namespace content
OLDNEW
« no previous file with comments | « components/handoff/handoff_manager.mm ('k') | content/browser/bootstrap_sandbox_manager_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698