Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "ios/chrome/browser/ui/omnibox/location_bar_controller_impl.h" | |
| 6 | |
| 5 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 6 | 8 |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 11 #include "components/omnibox/browser/omnibox_edit_model.h" | 13 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 12 #include "components/security_state/core/security_state_ui.h" | 14 #include "components/security_state/core/security_state_ui.h" |
| 13 #include "components/strings/grit/components_strings.h" | 15 #include "components/strings/grit/components_strings.h" |
| 14 #include "components/toolbar/toolbar_model.h" | 16 #include "components/toolbar/toolbar_model.h" |
| 15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 17 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 16 #include "ios/chrome/browser/chrome_url_constants.h" | 18 #include "ios/chrome/browser/chrome_url_constants.h" |
| 17 #include "ios/chrome/browser/experimental_flags.h" | 19 #include "ios/chrome/browser/experimental_flags.h" |
| 18 #include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" | 20 #include "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
| 19 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 21 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 20 #include "ios/chrome/browser/ui/omnibox/location_bar_view_ios.h" | |
| 21 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" | 22 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" |
| 22 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" | 23 #include "ios/chrome/browser/ui/omnibox/omnibox_view_ios.h" |
| 23 #include "ios/chrome/browser/ui/ui_util.h" | 24 #include "ios/chrome/browser/ui/ui_util.h" |
| 24 #import "ios/chrome/browser/ui/uikit_ui_util.h" | 25 #import "ios/chrome/browser/ui/uikit_ui_util.h" |
| 25 #include "ios/chrome/grit/ios_strings.h" | 26 #include "ios/chrome/grit/ios_strings.h" |
| 26 #include "ios/chrome/grit/ios_theme_resources.h" | 27 #include "ios/chrome/grit/ios_theme_resources.h" |
| 28 #include "ios/shared/chrome/browser/ui/omnibox/location_bar_delegate.h" | |
| 27 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" | 29 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoF ontLoader.h" |
| 28 #include "ios/web/public/navigation_item.h" | 30 #include "ios/web/public/navigation_item.h" |
| 29 #include "ios/web/public/navigation_manager.h" | 31 #include "ios/web/public/navigation_manager.h" |
| 30 #include "ios/web/public/ssl_status.h" | 32 #include "ios/web/public/ssl_status.h" |
| 31 #include "ios/web/public/web_state/web_state.h" | 33 #include "ios/web/public/web_state/web_state.h" |
| 32 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 33 | 35 |
| 34 #if !defined(__has_feature) || !__has_feature(objc_arc) | 36 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 35 #error "This file requires ARC support." | 37 #error "This file requires ARC support." |
| 36 #endif | 38 #endif |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 NOTREACHED(); | 105 NOTREACHED(); |
| 104 return nil; | 106 return nil; |
| 105 } | 107 } |
| 106 | 108 |
| 107 - (void)clearText { | 109 - (void)clearText { |
| 108 _omniboxView->ClearText(); | 110 _omniboxView->ClearText(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 @end | 113 @end |
| 112 | 114 |
| 113 LocationBarViewIOS::LocationBarViewIOS(OmniboxTextFieldIOS* field, | 115 LocationBarControllerImpl::LocationBarControllerImpl( |
| 114 ios::ChromeBrowserState* browser_state, | 116 OmniboxTextFieldIOS* field, |
| 115 id<PreloadProvider> preloader, | 117 ios::ChromeBrowserState* browser_state, |
| 116 id<OmniboxPopupPositioner> positioner, | 118 id<PreloadProvider> preloader, |
| 117 id<LocationBarDelegate> delegate) | 119 id<OmniboxPopupPositioner> positioner, |
| 120 id<LocationBarDelegate> delegate) | |
| 118 : edit_view_(new OmniboxViewIOS(field, | 121 : edit_view_(new OmniboxViewIOS(field, |
|
sdefresne
2017/04/04 13:58:17
nit: use base::MakeUnique<> if possible
rohitrao (ping after 24h)
2017/04/04 14:32:30
Done.
| |
| 119 this, | 122 this, |
| 120 browser_state, | 123 browser_state, |
| 121 preloader, | 124 preloader, |
| 122 positioner)), | 125 positioner)), |
| 123 field_(field), | 126 field_(field), |
| 124 delegate_(delegate) { | 127 delegate_(delegate) { |
| 125 DCHECK([delegate_ toolbarModel]); | 128 DCHECK([delegate_ toolbarModel]); |
| 126 show_hint_text_ = true; | 129 show_hint_text_ = true; |
| 127 | 130 |
| 128 InstallLocationIcon(); | 131 InstallLocationIcon(); |
| 129 CreateClearTextIcon(browser_state->IsOffTheRecord()); | 132 CreateClearTextIcon(browser_state->IsOffTheRecord()); |
| 130 } | 133 } |
| 131 | 134 |
| 132 LocationBarViewIOS::~LocationBarViewIOS() {} | 135 LocationBarControllerImpl::~LocationBarControllerImpl() {} |
| 133 | 136 |
| 134 void LocationBarViewIOS::HideKeyboardAndEndEditing() { | 137 void LocationBarControllerImpl::HideKeyboardAndEndEditing() { |
| 135 edit_view_->HideKeyboardAndEndEditing(); | 138 edit_view_->HideKeyboardAndEndEditing(); |
| 136 } | 139 } |
| 137 | 140 |
| 138 void LocationBarViewIOS::SetShouldShowHintText(bool show_hint_text) { | 141 void LocationBarControllerImpl::SetShouldShowHintText(bool show_hint_text) { |
| 139 show_hint_text_ = show_hint_text; | 142 show_hint_text_ = show_hint_text; |
| 140 } | 143 } |
| 141 | 144 |
| 142 const OmniboxView* LocationBarViewIOS::GetLocationEntry() const { | 145 const OmniboxView* LocationBarControllerImpl::GetLocationEntry() const { |
| 143 return edit_view_.get(); | 146 return edit_view_.get(); |
| 144 } | 147 } |
| 145 | 148 |
| 146 OmniboxView* LocationBarViewIOS::GetLocationEntry() { | 149 OmniboxView* LocationBarControllerImpl::GetLocationEntry() { |
| 147 return edit_view_.get(); | 150 return edit_view_.get(); |
| 148 } | 151 } |
| 149 | 152 |
| 150 void LocationBarViewIOS::OnToolbarUpdated() { | 153 void LocationBarControllerImpl::OnToolbarUpdated() { |
| 151 edit_view_->UpdateAppearance(); | 154 edit_view_->UpdateAppearance(); |
| 152 OnChanged(); | 155 OnChanged(); |
| 153 } | 156 } |
| 154 | 157 |
| 155 void LocationBarViewIOS::OnAutocompleteAccept( | 158 void LocationBarControllerImpl::OnAutocompleteAccept( |
| 156 const GURL& gurl, | 159 const GURL& gurl, |
| 157 WindowOpenDisposition disposition, | 160 WindowOpenDisposition disposition, |
| 158 ui::PageTransition transition, | 161 ui::PageTransition transition, |
| 159 AutocompleteMatchType::Type type) { | 162 AutocompleteMatchType::Type type) { |
| 160 if (gurl.is_valid()) { | 163 if (gurl.is_valid()) { |
| 161 transition = ui::PageTransitionFromInt( | 164 transition = ui::PageTransitionFromInt( |
| 162 transition | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 165 transition | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
| 163 [delegate_ loadGURLFromLocationBar:gurl transition:transition]; | 166 [delegate_ loadGURLFromLocationBar:gurl transition:transition]; |
| 164 } | 167 } |
| 165 } | 168 } |
| 166 | 169 |
| 167 void LocationBarViewIOS::OnChanged() { | 170 void LocationBarControllerImpl::OnChanged() { |
| 168 const bool page_is_offline = IsCurrentPageOffline(GetWebState()); | 171 const bool page_is_offline = IsCurrentPageOffline(GetWebState()); |
| 169 const int resource_id = edit_view_->GetIcon(page_is_offline); | 172 const int resource_id = edit_view_->GetIcon(page_is_offline); |
| 170 [field_ setPlaceholderImage:resource_id]; | 173 [field_ setPlaceholderImage:resource_id]; |
| 171 | 174 |
| 172 // TODO(rohitrao): Can we get focus information from somewhere other than the | 175 // TODO(rohitrao): Can we get focus information from somewhere other than the |
| 173 // model? | 176 // model? |
| 174 if (!IsIPadIdiom() && !edit_view_->model()->has_focus()) { | 177 if (!IsIPadIdiom() && !edit_view_->model()->has_focus()) { |
| 175 ToolbarModel* toolbarModel = [delegate_ toolbarModel]; | 178 ToolbarModel* toolbarModel = [delegate_ toolbarModel]; |
| 176 if (toolbarModel) { | 179 if (toolbarModel) { |
| 177 bool show_icon_for_state = security_state::ShouldAlwaysShowIcon( | 180 bool show_icon_for_state = security_state::ShouldAlwaysShowIcon( |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 189 } | 192 } |
| 190 } | 193 } |
| 191 UpdateRightDecorations(); | 194 UpdateRightDecorations(); |
| 192 [delegate_ locationBarChanged]; | 195 [delegate_ locationBarChanged]; |
| 193 | 196 |
| 194 NSString* placeholderText = | 197 NSString* placeholderText = |
| 195 show_hint_text_ ? l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT) : nil; | 198 show_hint_text_ ? l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT) : nil; |
| 196 [field_ setPlaceholder:placeholderText]; | 199 [field_ setPlaceholder:placeholderText]; |
| 197 } | 200 } |
| 198 | 201 |
| 199 bool LocationBarViewIOS::IsShowingPlaceholderWhileCollapsed() { | 202 bool LocationBarControllerImpl::IsShowingPlaceholderWhileCollapsed() { |
| 200 return is_showing_placeholder_while_collapsed_; | 203 return is_showing_placeholder_while_collapsed_; |
| 201 } | 204 } |
| 202 | 205 |
| 203 void LocationBarViewIOS::OnInputInProgress(bool in_progress) { | 206 void LocationBarControllerImpl::OnInputInProgress(bool in_progress) { |
| 204 if ([delegate_ toolbarModel]) | 207 if ([delegate_ toolbarModel]) |
| 205 [delegate_ toolbarModel]->set_input_in_progress(in_progress); | 208 [delegate_ toolbarModel]->set_input_in_progress(in_progress); |
| 206 if (in_progress) | 209 if (in_progress) |
| 207 [delegate_ locationBarBeganEdit]; | 210 [delegate_ locationBarBeganEdit]; |
| 208 } | 211 } |
| 209 | 212 |
| 210 void LocationBarViewIOS::OnKillFocus() { | 213 void LocationBarControllerImpl::OnKillFocus() { |
| 211 // Hide the location icon on phone. A subsequent call to OnChanged() will | 214 // Hide the location icon on phone. A subsequent call to OnChanged() will |
| 212 // bring the icon back if needed. | 215 // bring the icon back if needed. |
| 213 if (!IsIPadIdiom()) { | 216 if (!IsIPadIdiom()) { |
| 214 [field_ hidePlaceholderImage]; | 217 [field_ hidePlaceholderImage]; |
| 215 is_showing_placeholder_while_collapsed_ = false; | 218 is_showing_placeholder_while_collapsed_ = false; |
| 216 } | 219 } |
| 217 | 220 |
| 218 // Update the placeholder icon. | 221 // Update the placeholder icon. |
| 219 const int resource_id = | 222 const int resource_id = |
| 220 edit_view_->GetIcon(IsCurrentPageOffline(GetWebState())); | 223 edit_view_->GetIcon(IsCurrentPageOffline(GetWebState())); |
| 221 [field_ setPlaceholderImage:resource_id]; | 224 [field_ setPlaceholderImage:resource_id]; |
| 222 | 225 |
| 223 // Show the placeholder text on iPad. | 226 // Show the placeholder text on iPad. |
| 224 if (IsIPadIdiom()) { | 227 if (IsIPadIdiom()) { |
| 225 NSString* placeholderText = l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT); | 228 NSString* placeholderText = l10n_util::GetNSString(IDS_OMNIBOX_EMPTY_HINT); |
| 226 [field_ setPlaceholder:placeholderText]; | 229 [field_ setPlaceholder:placeholderText]; |
| 227 } | 230 } |
| 228 | 231 |
| 229 UpdateRightDecorations(); | 232 UpdateRightDecorations(); |
| 230 [delegate_ locationBarHasResignedFirstResponder]; | 233 [delegate_ locationBarHasResignedFirstResponder]; |
| 231 } | 234 } |
| 232 | 235 |
| 233 void LocationBarViewIOS::OnSetFocus() { | 236 void LocationBarControllerImpl::OnSetFocus() { |
| 234 // Show the location icon on phone. | 237 // Show the location icon on phone. |
| 235 if (!IsIPadIdiom()) | 238 if (!IsIPadIdiom()) |
| 236 [field_ showPlaceholderImage]; | 239 [field_ showPlaceholderImage]; |
| 237 | 240 |
| 238 // Update the placeholder icon. | 241 // Update the placeholder icon. |
| 239 const int resource_id = | 242 const int resource_id = |
| 240 edit_view_->GetIcon(IsCurrentPageOffline(GetWebState())); | 243 edit_view_->GetIcon(IsCurrentPageOffline(GetWebState())); |
| 241 [field_ setPlaceholderImage:resource_id]; | 244 [field_ setPlaceholderImage:resource_id]; |
| 242 | 245 |
| 243 // Hide the placeholder text on iPad. | 246 // Hide the placeholder text on iPad. |
| 244 if (IsIPadIdiom()) { | 247 if (IsIPadIdiom()) { |
| 245 [field_ setPlaceholder:nil]; | 248 [field_ setPlaceholder:nil]; |
| 246 } | 249 } |
| 247 UpdateRightDecorations(); | 250 UpdateRightDecorations(); |
| 248 [delegate_ locationBarHasBecomeFirstResponder]; | 251 [delegate_ locationBarHasBecomeFirstResponder]; |
| 249 } | 252 } |
| 250 | 253 |
| 251 const ToolbarModel* LocationBarViewIOS::GetToolbarModel() const { | 254 const ToolbarModel* LocationBarControllerImpl::GetToolbarModel() const { |
| 252 return [delegate_ toolbarModel]; | 255 return [delegate_ toolbarModel]; |
| 253 } | 256 } |
| 254 | 257 |
| 255 ToolbarModel* LocationBarViewIOS::GetToolbarModel() { | 258 ToolbarModel* LocationBarControllerImpl::GetToolbarModel() { |
| 256 return [delegate_ toolbarModel]; | 259 return [delegate_ toolbarModel]; |
| 257 } | 260 } |
| 258 | 261 |
| 259 web::WebState* LocationBarViewIOS::GetWebState() { | 262 web::WebState* LocationBarControllerImpl::GetWebState() { |
| 260 return [delegate_ getWebState]; | 263 return [delegate_ getWebState]; |
| 261 } | 264 } |
| 262 | 265 |
| 263 void LocationBarViewIOS::InstallLocationIcon() { | 266 void LocationBarControllerImpl::InstallLocationIcon() { |
| 264 // Set the placeholder for empty omnibox. | 267 // Set the placeholder for empty omnibox. |
| 265 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; | 268 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 266 UIImage* image = NativeImage(IDR_IOS_OMNIBOX_SEARCH); | 269 UIImage* image = NativeImage(IDR_IOS_OMNIBOX_SEARCH); |
| 267 [button setImage:image forState:UIControlStateNormal]; | 270 [button setImage:image forState:UIControlStateNormal]; |
| 268 [button setFrame:CGRectMake(0, 0, image.size.width, image.size.height)]; | 271 [button setFrame:CGRectMake(0, 0, image.size.width, image.size.height)]; |
| 269 [button addTarget:nil | 272 [button addTarget:nil |
| 270 action:@selector(chromeExecuteCommand:) | 273 action:@selector(chromeExecuteCommand:) |
| 271 forControlEvents:UIControlEventTouchUpInside]; | 274 forControlEvents:UIControlEventTouchUpInside]; |
| 272 [button setTag:IDC_SHOW_PAGE_INFO]; | 275 [button setTag:IDC_SHOW_PAGE_INFO]; |
| 273 SetA11yLabelAndUiAutomationName( | 276 SetA11yLabelAndUiAutomationName( |
| 274 button, IDS_IOS_PAGE_INFO_SECURITY_BUTTON_ACCESSIBILITY_LABEL, | 277 button, IDS_IOS_PAGE_INFO_SECURITY_BUTTON_ACCESSIBILITY_LABEL, |
| 275 @"Page Security Info"); | 278 @"Page Security Info"); |
| 276 [button setIsAccessibilityElement:YES]; | 279 [button setIsAccessibilityElement:YES]; |
| 277 | 280 |
| 278 // Set chip text options. | 281 // Set chip text options. |
| 279 [button setTitleColor:[UIColor colorWithWhite:0.631 alpha:1] | 282 [button setTitleColor:[UIColor colorWithWhite:0.631 alpha:1] |
| 280 forState:UIControlStateNormal]; | 283 forState:UIControlStateNormal]; |
| 281 [button titleLabel].font = | 284 [button titleLabel].font = |
| 282 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12]; | 285 [[MDFRobotoFontLoader sharedInstance] regularFontOfSize:12]; |
| 283 [field_ setLeftView:button]; | 286 [field_ setLeftView:button]; |
| 284 | 287 |
| 285 // The placeholder image is only shown when in edit mode on iPhone, and always | 288 // The placeholder image is only shown when in edit mode on iPhone, and always |
| 286 // shown on iPad. | 289 // shown on iPad. |
| 287 if (IsIPadIdiom()) | 290 if (IsIPadIdiom()) |
| 288 [field_ setLeftViewMode:UITextFieldViewModeAlways]; | 291 [field_ setLeftViewMode:UITextFieldViewModeAlways]; |
| 289 else | 292 else |
| 290 [field_ setLeftViewMode:UITextFieldViewModeNever]; | 293 [field_ setLeftViewMode:UITextFieldViewModeNever]; |
| 291 } | 294 } |
| 292 | 295 |
| 293 void LocationBarViewIOS::CreateClearTextIcon(bool is_incognito) { | 296 void LocationBarControllerImpl::CreateClearTextIcon(bool is_incognito) { |
| 294 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; | 297 UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 295 UIImage* omniBoxClearImage = is_incognito | 298 UIImage* omniBoxClearImage = is_incognito |
| 296 ? NativeImage(IDR_IOS_OMNIBOX_CLEAR_OTR) | 299 ? NativeImage(IDR_IOS_OMNIBOX_CLEAR_OTR) |
| 297 : NativeImage(IDR_IOS_OMNIBOX_CLEAR); | 300 : NativeImage(IDR_IOS_OMNIBOX_CLEAR); |
| 298 UIImage* omniBoxClearPressedImage = | 301 UIImage* omniBoxClearPressedImage = |
| 299 is_incognito ? NativeImage(IDR_IOS_OMNIBOX_CLEAR_OTR_PRESSED) | 302 is_incognito ? NativeImage(IDR_IOS_OMNIBOX_CLEAR_OTR_PRESSED) |
| 300 : NativeImage(IDR_IOS_OMNIBOX_CLEAR_PRESSED); | 303 : NativeImage(IDR_IOS_OMNIBOX_CLEAR_PRESSED); |
| 301 [button setImage:omniBoxClearImage forState:UIControlStateNormal]; | 304 [button setImage:omniBoxClearImage forState:UIControlStateNormal]; |
| 302 [button setImage:omniBoxClearPressedImage forState:UIControlStateHighlighted]; | 305 [button setImage:omniBoxClearPressedImage forState:UIControlStateHighlighted]; |
| 303 | 306 |
| 304 CGRect frame = CGRectZero; | 307 CGRect frame = CGRectZero; |
| 305 frame.size = CGSizeMake(kClearTextButtonWidth, kClearTextButtonHeight); | 308 frame.size = CGSizeMake(kClearTextButtonWidth, kClearTextButtonHeight); |
| 306 [button setFrame:frame]; | 309 [button setFrame:frame]; |
| 307 | 310 |
| 308 clear_button_bridge_.reset( | 311 clear_button_bridge_.reset( |
| 309 [[OmniboxClearButtonBridge alloc] initWithOmniboxView:edit_view_.get()]); | 312 [[OmniboxClearButtonBridge alloc] initWithOmniboxView:edit_view_.get()]); |
| 310 [button addTarget:clear_button_bridge_ | 313 [button addTarget:clear_button_bridge_ |
| 311 action:@selector(clearText) | 314 action:@selector(clearText) |
| 312 forControlEvents:UIControlEventTouchUpInside]; | 315 forControlEvents:UIControlEventTouchUpInside]; |
| 313 clear_text_button_.reset(button); | 316 clear_text_button_.reset(button); |
| 314 | 317 |
| 315 SetA11yLabelAndUiAutomationName(clear_text_button_, | 318 SetA11yLabelAndUiAutomationName(clear_text_button_, |
| 316 IDS_IOS_ACCNAME_CLEAR_TEXT, @"Clear Text"); | 319 IDS_IOS_ACCNAME_CLEAR_TEXT, @"Clear Text"); |
| 317 } | 320 } |
| 318 | 321 |
| 319 void LocationBarViewIOS::UpdateRightDecorations() { | 322 void LocationBarControllerImpl::UpdateRightDecorations() { |
| 320 DCHECK(clear_text_button_); | 323 DCHECK(clear_text_button_); |
| 321 if (!edit_view_->model()->has_focus()) { | 324 if (!edit_view_->model()->has_focus()) { |
| 322 // Do nothing for iPhone. The right view will be set to nil after the | 325 // Do nothing for iPhone. The right view will be set to nil after the |
| 323 // omnibox animation is completed. | 326 // omnibox animation is completed. |
| 324 if (IsIPadIdiom()) | 327 if (IsIPadIdiom()) |
| 325 [field_ setRightView:nil]; | 328 [field_ setRightView:nil]; |
| 326 } else if ([field_ displayedText].empty() && | 329 } else if ([field_ displayedText].empty() && |
| 327 ![field_ isShowingQueryRefinementChip]) { | 330 ![field_ isShowingQueryRefinementChip]) { |
| 328 [field_ setRightView:nil]; | 331 [field_ setRightView:nil]; |
| 329 } else { | 332 } else { |
| 330 [field_ setRightView:clear_text_button_]; | 333 [field_ setRightView:clear_text_button_]; |
| 331 [clear_text_button_ setAlpha:1]; | 334 [clear_text_button_ setAlpha:1]; |
| 332 } | 335 } |
| 333 } | 336 } |
| OLD | NEW |