| 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 "base/ios/block_types.h" | 7 #include "base/ios/block_types.h" |
| 8 #include "base/ios/ios_util.h" | 8 #include "base/ios/ios_util.h" |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/scoped_block.h" | 10 #include "base/mac/scoped_block.h" |
| 11 #include "base/mac/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #import "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" | 13 #import "components/autofill/core/browser/keyboard_accessory_metrics_logger.h" |
| 14 #import "components/autofill/ios/browser/js_suggestion_manager.h" | 14 #import "components/autofill/ios/browser/js_suggestion_manager.h" |
| 15 #import "ios/chrome/browser/autofill/form_input_accessory_view.h" | 15 #import "ios/chrome/browser/autofill/form_input_accessory_view.h" |
| 16 #import "ios/chrome/browser/autofill/form_suggestion_view.h" | 16 #import "ios/chrome/browser/autofill/form_suggestion_view.h" |
| 17 #import "ios/chrome/browser/passwords/password_generation_utils.h" | 17 #import "ios/chrome/browser/passwords/password_generation_utils.h" |
| 18 #include "ios/chrome/browser/ui/ui_util.h" | 18 #include "ios/chrome/browser/ui/ui_util.h" |
| 19 #include "ios/chrome/grit/ios_strings.h" | |
| 20 #include "ios/web/public/test/crw_test_js_injection_receiver.h" | 19 #include "ios/web/public/test/crw_test_js_injection_receiver.h" |
| 21 #import "ios/web/public/url_scheme_util.h" | 20 #import "ios/web/public/url_scheme_util.h" |
| 22 #import "ios/web/public/web_state/crw_web_view_proxy.h" | 21 #import "ios/web/public/web_state/crw_web_view_proxy.h" |
| 23 #include "ios/web/public/web_state/url_verification_constants.h" | 22 #include "ios/web/public/web_state/url_verification_constants.h" |
| 24 #include "ios/web/public/web_state/web_state.h" | 23 #include "ios/web/public/web_state/web_state.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | |
| 26 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 27 | 25 |
| 28 namespace autofill { | 26 namespace autofill { |
| 29 NSString* const kFormSuggestionAssistButtonPreviousElement = @"previousTap"; | 27 NSString* const kFormSuggestionAssistButtonPreviousElement = @"previousTap"; |
| 30 NSString* const kFormSuggestionAssistButtonNextElement = @"nextTap"; | 28 NSString* const kFormSuggestionAssistButtonNextElement = @"nextTap"; |
| 31 NSString* const kFormSuggestionAssistButtonDone = @"done"; | 29 NSString* const kFormSuggestionAssistButtonDone = @"done"; |
| 32 CGFloat const kInputAccessoryHeight = 44.0f; | 30 CGFloat const kInputAccessoryHeight = 44.0f; |
| 33 } // namespace autofill | 31 } // namespace autofill |
| 34 | 32 |
| 35 namespace { | 33 namespace { |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 [self hideSubviewsInOriginalAccessoryView:inputAccessoryView]; | 370 [self hideSubviewsInOriginalAccessoryView:inputAccessoryView]; |
| 373 _customAccessoryView.reset([[FormInputAccessoryView alloc] | 371 _customAccessoryView.reset([[FormInputAccessoryView alloc] |
| 374 initWithFrame:inputAccessoryView.frame | 372 initWithFrame:inputAccessoryView.frame |
| 375 delegate:self | 373 delegate:self |
| 376 customView:view | 374 customView:view |
| 377 leftFrame:leftFrame | 375 leftFrame:leftFrame |
| 378 rightFrame:rightFrame]); | 376 rightFrame:rightFrame]); |
| 379 [inputAccessoryView addSubview:_customAccessoryView]; | 377 [inputAccessoryView addSubview:_customAccessoryView]; |
| 380 } | 378 } |
| 381 } | 379 } |
| 382 UIAccessibilityPostNotification( | |
| 383 UIAccessibilityScreenChangedNotification, | |
| 384 l10n_util::GetNSString(IDS_IOS_AUTOFILL_ACCNAME_PREVIOUS_FIELD)); | |
| 385 } | 380 } |
| 386 | 381 |
| 387 - (void)restoreDefaultInputAccessoryView { | 382 - (void)restoreDefaultInputAccessoryView { |
| 388 [_customAccessoryView removeFromSuperview]; | 383 [_customAccessoryView removeFromSuperview]; |
| 389 _customAccessoryView.reset(); | 384 _customAccessoryView.reset(); |
| 390 for (UIView* subview in _hiddenOriginalSubviews.get()) { | 385 for (UIView* subview in _hiddenOriginalSubviews.get()) { |
| 391 subview.hidden = NO; | 386 subview.hidden = NO; |
| 392 } | 387 } |
| 393 [_hiddenOriginalSubviews removeAllObjects]; | 388 [_hiddenOriginalSubviews removeAllObjects]; |
| 394 } | 389 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // that we don't present our custom view over the keyboard. | 667 // that we don't present our custom view over the keyboard. |
| 673 - (void)textInputDidBeginEditing:(NSNotification*)notification { | 668 - (void)textInputDidBeginEditing:(NSNotification*)notification { |
| 674 [self reset]; | 669 [self reset]; |
| 675 } | 670 } |
| 676 | 671 |
| 677 - (void)keyboardDidHide:(NSNotification*)notification { | 672 - (void)keyboardDidHide:(NSNotification*)notification { |
| 678 _keyboardFrame = CGRectZero; | 673 _keyboardFrame = CGRectZero; |
| 679 } | 674 } |
| 680 | 675 |
| 681 @end | 676 @end |
| OLD | NEW |