| 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_suggestion_controller.h" | 5 #import "ios/chrome/browser/autofill/form_suggestion_controller.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #include "base/ios/weak_nsobject.h" | 10 #include "base/ios/weak_nsobject.h" |
| 11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 12 #include "base/mac/scoped_block.h" | 12 #include "base/mac/scoped_block.h" |
| 13 #include "base/mac/scoped_nsobject.h" | 13 #include "base/mac/scoped_nsobject.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "components/autofill/core/browser/autofill_field_trial_ios.h" | |
| 17 #include "components/autofill/core/browser/autofill_popup_delegate.h" | 16 #include "components/autofill/core/browser/autofill_popup_delegate.h" |
| 18 #import "components/autofill/ios/browser/form_suggestion.h" | 17 #import "components/autofill/ios/browser/form_suggestion.h" |
| 19 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" | 18 #import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h" |
| 20 #import "ios/chrome/browser/autofill/form_suggestion_provider.h" | 19 #import "ios/chrome/browser/autofill/form_suggestion_provider.h" |
| 21 #import "ios/chrome/browser/autofill/form_suggestion_view.h" | 20 #import "ios/chrome/browser/autofill/form_suggestion_view.h" |
| 22 #import "ios/chrome/browser/passwords/password_generation_utils.h" | 21 #import "ios/chrome/browser/passwords/password_generation_utils.h" |
| 23 #include "ios/chrome/browser/ui/ui_util.h" | 22 #include "ios/chrome/browser/ui/ui_util.h" |
| 24 #import "ios/web/public/url_scheme_util.h" | 23 #import "ios/web/public/url_scheme_util.h" |
| 25 #import "ios/web/public/web_state/crw_web_view_proxy.h" | 24 #import "ios/web/public/web_state/crw_web_view_proxy.h" |
| 26 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" | 25 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return; | 296 return; |
| 298 | 297 |
| 299 // Send the suggestion to the provider. Upon completion advance the cursor | 298 // Send the suggestion to the provider. Upon completion advance the cursor |
| 300 // for single-field Autofill, or close the keyboard for full-form Autofill. | 299 // for single-field Autofill, or close the keyboard for full-form Autofill. |
| 301 base::WeakNSObject<FormSuggestionController> weakSelf(self); | 300 base::WeakNSObject<FormSuggestionController> weakSelf(self); |
| 302 [_provider | 301 [_provider |
| 303 didSelectSuggestion:suggestion | 302 didSelectSuggestion:suggestion |
| 304 forField:base::SysUTF8ToNSString(_suggestionState->field_name) | 303 forField:base::SysUTF8ToNSString(_suggestionState->field_name) |
| 305 form:base::SysUTF8ToNSString(_suggestionState->form_name) | 304 form:base::SysUTF8ToNSString(_suggestionState->form_name) |
| 306 completionHandler:^{ | 305 completionHandler:^{ |
| 307 if (autofill::AutofillFieldTrialIOS::IsFullFormAutofillEnabled()) { | 306 [[weakSelf accessoryViewDelegate] closeKeyboardWithoutButtonPress]; |
| 308 [[weakSelf accessoryViewDelegate] closeKeyboardWithoutButtonPress]; | |
| 309 } else { | |
| 310 [[weakSelf accessoryViewDelegate] | |
| 311 selectNextElementWithoutButtonPress]; | |
| 312 } | |
| 313 }]; | 307 }]; |
| 314 _provider = nil; | 308 _provider = nil; |
| 315 } | 309 } |
| 316 | 310 |
| 317 - (id<FormInputAccessoryViewProvider>)accessoryViewProvider { | 311 - (id<FormInputAccessoryViewProvider>)accessoryViewProvider { |
| 318 return self; | 312 return self; |
| 319 } | 313 } |
| 320 | 314 |
| 321 #pragma mark FormInputAccessoryViewProvider | 315 #pragma mark FormInputAccessoryViewProvider |
| 322 | 316 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 358 |
| 365 - (void)resizeAccessoryView { | 359 - (void)resizeAccessoryView { |
| 366 [self updateKeyboard:_suggestionState.get()]; | 360 [self updateKeyboard:_suggestionState.get()]; |
| 367 } | 361 } |
| 368 | 362 |
| 369 - (BOOL)getLogKeyboardAccessoryMetrics { | 363 - (BOOL)getLogKeyboardAccessoryMetrics { |
| 370 return YES; | 364 return YES; |
| 371 } | 365 } |
| 372 | 366 |
| 373 @end | 367 @end |
| OLD | NEW |