Commit 06ea7b0c authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

Update omnibox clear button visibility on focus.

Monitor omnibox focus notification to update the clear button visibility
on focus.

Bug: 866446, 865019, 865013, 864511
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Iecf54d4550e4c6fe3f3988a54602c4d32d417f89
Reviewed-on: https://chromium-review.googlesource.com/1143860
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577161}
parent 66145a8b
......@@ -85,6 +85,13 @@ const CGFloat kClearButtonSize = 28.0f;
self.textField.placeholderTextColor = [self placeholderAndClearButtonColor];
self.textField.placeholder = l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT);
[self setupClearButton];
// TODO(crbug.com/866446): Use UITextFieldDelegate instead.
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(textFieldDidBeginEditing)
name:UITextFieldTextDidBeginEditingNotification
object:self.textField];
}
- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection {
......@@ -122,6 +129,14 @@ const CGFloat kClearButtonSize = 28.0f;
: [UIColor colorWithWhite:0 alpha:0.3];
}
#pragma mark notification callbacks
// Called on UITextFieldTextDidBeginEditingNotification for self.textField.
- (void)textFieldDidBeginEditing {
// Update the clear button state.
[self updateClearButtonVisibility];
}
#pragma mark clear button
// Omnibox uses a custom clear button. It has a custom tint and image, but
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment