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

Side by Side Diff: ios/chrome/browser/ui/toolbar/new_keyboard_accessory_view.mm

Issue 2956103002: [iOS] Add accessibility labels to Keyboard Accessory View buttons. (Closed)
Patch Set: Created 3 years, 5 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 | « ios/chrome/app/strings/ios_strings.grd ('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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #import "ios/chrome/browser/ui/toolbar/new_keyboard_accessory_view.h" 5 #import "ios/chrome/browser/ui/toolbar/new_keyboard_accessory_view.h"
6 6
7 #import <NotificationCenter/NotificationCenter.h> 7 #import <NotificationCenter/NotificationCenter.h>
8 8
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "ios/chrome/browser/experimental_flags.h" 10 #include "ios/chrome/browser/experimental_flags.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 [shortcutStackView addArrangedSubview:button]; 79 [shortcutStackView addArrangedSubview:button];
80 } 80 }
81 [self addSubview:shortcutStackView]; 81 [self addSubview:shortcutStackView];
82 82
83 // Create buttons for voice search and camera search. 83 // Create buttons for voice search and camera search.
84 UIButton* voiceSearchButton = 84 UIButton* voiceSearchButton =
85 [self iconButton:@"keyboard_accessory_voice_search"]; 85 [self iconButton:@"keyboard_accessory_voice_search"];
86 [voiceSearchButton addTarget:_delegate 86 [voiceSearchButton addTarget:_delegate
87 action:@selector(keyboardAccessoryVoiceSearchTouchDown) 87 action:@selector(keyboardAccessoryVoiceSearchTouchDown)
88 forControlEvents:UIControlEventTouchDown]; 88 forControlEvents:UIControlEventTouchDown];
89 SetA11yLabelAndUiAutomationName(voiceSearchButton,
90 IDS_IOS_KEYBOARD_ACCESSORY_VIEW_VOICE_SEARCH,
91 @"Voice Search");
89 [voiceSearchButton 92 [voiceSearchButton
90 addTarget:_delegate 93 addTarget:_delegate
91 action:@selector(keyboardAccessoryVoiceSearchTouchUpInside) 94 action:@selector(keyboardAccessoryVoiceSearchTouchUpInside)
92 forControlEvents:UIControlEventTouchUpInside]; 95 forControlEvents:UIControlEventTouchUpInside];
93 UIButton* cameraButton = [self iconButton:@"keyboard_accessory_qr_scanner"]; 96 UIButton* cameraButton = [self iconButton:@"keyboard_accessory_qr_scanner"];
94 [cameraButton addTarget:_delegate 97 [cameraButton addTarget:_delegate
95 action:@selector(keyboardAccessoryCameraSearchTouchUpInside) 98 action:@selector(keyboardAccessoryCameraSearchTouchUpInside)
96 forControlEvents:UIControlEventTouchUpInside]; 99 forControlEvents:UIControlEventTouchUpInside];
100 SetA11yLabelAndUiAutomationName(
101 cameraButton, IDS_IOS_KEYBOARD_ACCESSORY_VIEW_QR_CODE_SEARCH,
102 @"QR code Search");
97 103
98 // Create and add a stackview containing containing the buttons for voice 104 // Create and add a stackview containing containing the buttons for voice
99 // search and camera search. 105 // search and camera search.
100 UIStackView* searchStackView = [[UIStackView alloc] init]; 106 UIStackView* searchStackView = [[UIStackView alloc] init];
101 searchStackView.translatesAutoresizingMaskIntoConstraints = NO; 107 searchStackView.translatesAutoresizingMaskIntoConstraints = NO;
102 searchStackView.spacing = kBetweenSearchButtonSpacing; 108 searchStackView.spacing = kBetweenSearchButtonSpacing;
103 [searchStackView addArrangedSubview:voiceSearchButton]; 109 [searchStackView addArrangedSubview:voiceSearchButton];
104 [searchStackView addArrangedSubview:cameraButton]; 110 [searchStackView addArrangedSubview:cameraButton];
105 [self addSubview:searchStackView]; 111 [self addSubview:searchStackView];
106 112
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return YES; 174 return YES;
169 } 175 }
170 176
171 - (void)keyboardButtonPressed:(id)sender { 177 - (void)keyboardButtonPressed:(id)sender {
172 UIButton* button = base::mac::ObjCCastStrict<UIButton>(sender); 178 UIButton* button = base::mac::ObjCCastStrict<UIButton>(sender);
173 [[UIDevice currentDevice] playInputClick]; 179 [[UIDevice currentDevice] playInputClick];
174 [_delegate keyPressed:[button currentTitle]]; 180 [_delegate keyPressed:[button currentTitle]];
175 } 181 }
176 182
177 @end 183 @end
OLDNEW
« no previous file with comments | « ios/chrome/app/strings/ios_strings.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698