| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/autofill/form_input_accessory_view_controller.h" | 5 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/ios/block_types.h" | 9 #include "base/ios/block_types.h" |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 if (CGRectIntersection([UIScreen mainScreen].bounds, _keyboardFrame) | 329 if (CGRectIntersection([UIScreen mainScreen].bounds, _keyboardFrame) |
| 330 .size.height == 0 || | 330 .size.height == 0 || |
| 331 CGRectEqualToRect(_keyboardFrame, CGRectZero)) { | 331 CGRectEqualToRect(_keyboardFrame, CGRectZero)) { |
| 332 _customAccessoryView.reset(); | 332 _customAccessoryView.reset(); |
| 333 return; | 333 return; |
| 334 } | 334 } |
| 335 | 335 |
| 336 // If this is a form suggestion view and no suggestions have been triggered | 336 // If this is a form suggestion view and no suggestions have been triggered |
| 337 // yet, don't show the custom view. | 337 // yet, don't show the custom view. |
| 338 FormSuggestionView* formSuggestionView = | 338 FormSuggestionView* formSuggestionView = |
| 339 base::mac::ObjCCastStrict<FormSuggestionView>(view); | 339 base::mac::ObjCCast<FormSuggestionView>(view); |
| 340 if (formSuggestionView) { | 340 if (formSuggestionView) { |
| 341 int numSuggestions = [[formSuggestionView suggestions] count]; | 341 int numSuggestions = [[formSuggestionView suggestions] count]; |
| 342 if (!_suggestionsHaveBeenShown && numSuggestions == 0) { | 342 if (!_suggestionsHaveBeenShown && numSuggestions == 0) { |
| 343 _customAccessoryView.reset(); | 343 _customAccessoryView.reset(); |
| 344 return; | 344 return; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 _suggestionsHaveBeenShown = YES; | 347 _suggestionsHaveBeenShown = YES; |
| 348 | 348 |
| 349 CGFloat height = autofill::kInputAccessoryHeight; | 349 CGFloat height = autofill::kInputAccessoryHeight; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 // that we don't present our custom view over the keyboard. | 648 // that we don't present our custom view over the keyboard. |
| 649 - (void)textInputDidBeginEditing:(NSNotification*)notification { | 649 - (void)textInputDidBeginEditing:(NSNotification*)notification { |
| 650 [self reset]; | 650 [self reset]; |
| 651 } | 651 } |
| 652 | 652 |
| 653 - (void)keyboardDidHide:(NSNotification*)notification { | 653 - (void)keyboardDidHide:(NSNotification*)notification { |
| 654 _keyboardFrame = CGRectZero; | 654 _keyboardFrame = CGRectZero; |
| 655 } | 655 } |
| 656 | 656 |
| 657 @end | 657 @end |
| OLD | NEW |