From d2dd476b17586f5e9e1332bed33d9c0c48a482a8 Mon Sep 17 00:00:00 2001 From: dconnelly Date: Mon, 20 Apr 2015 01:50:28 -0700 Subject: Rename some ios autofill things. BUG=none Review URL: https://codereview.chromium.org/1095493003 Cr-Commit-Position: refs/heads/master@{#325806} --- .../form_input_accessory_view_controller.h | 22 ++++++------- .../form_input_accessory_view_controller.mm | 10 +++--- .../browser/autofill/form_suggestion_controller.mm | 37 ++++++++++++---------- 3 files changed, 36 insertions(+), 33 deletions(-) (limited to 'ios') diff --git a/ios/chrome/browser/autofill/form_input_accessory_view_controller.h b/ios/chrome/browser/autofill/form_input_accessory_view_controller.h index 1ecb8ef..ad31dae 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view_controller.h +++ b/ios/chrome/browser/autofill/form_input_accessory_view_controller.h @@ -42,22 +42,23 @@ typedef void (^AccessoryViewReadyCompletion)( // Determines asynchronously if this provider has a view available for the // specified form/field and invokes |completionHandler| with the answer. -- (void)checkIfAccessoryViewAvailableForFormNamed:(const std::string&)formName - fieldName:(const std::string&)fieldName - webState:(web::WebState*)webState - completionHandler: - (AccessoryViewAvailableCompletion) - completionHandler; +- (void) + checkIfAccessoryViewIsAvailableForFormNamed:(const std::string&)formName + fieldName:(const std::string&)fieldName + webState:(web::WebState*)webState + completionHandler: + (AccessoryViewAvailableCompletion) + completionHandler; // Asynchronously retrieves an accessory view from this provider for the -// specified form/field and returns it via |completionHandler|. +// specified form/field and returns it via |accessoryViewUpdateBlock|. - (void)retrieveAccessoryViewForFormNamed:(const std::string&)formName fieldName:(const std::string&)fieldName value:(const std::string&)value type:(const std::string&)type webState:(web::WebState*)webState - completionHandler: - (AccessoryViewReadyCompletion)completionHandler; + accessoryViewUpdateBlock: + (AccessoryViewReadyCompletion)accessoryViewUpdateBlock; // Notifies this provider that the accessory view is going away. - (void)inputAccessoryViewControllerDidReset: @@ -65,8 +66,7 @@ typedef void (^AccessoryViewReadyCompletion)( // Notifies this provider that the accessory view frame is changing. If the // view provided by this provider needs to change, the updated view should be -// returned using the completion received in -// |retrieveAccessoryViewForForm:field:value:type:webState:completionHandler:|. +// set using |accessoryViewUpdateBlock|. - (void)resizeAccessoryView; @end diff --git a/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm b/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm index 97cf164..c05d591 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm +++ b/ios/chrome/browser/autofill/form_input_accessory_view_controller.mm @@ -433,10 +433,10 @@ bool ComputeFramesOfKeyboardParts(UIView* inputAccessoryView, return; id provider = strongSelf.get()->_providers[i]; - [provider checkIfAccessoryViewAvailableForFormNamed:strongFormName - fieldName:strongFieldName - webState:webState - completionHandler:completion]; + [provider checkIfAccessoryViewIsAvailableForFormNamed:strongFormName + fieldName:strongFieldName + webState:webState + completionHandler:completion]; }, base::scoped_policy::RETAIN); [findProviderBlocks addObject:block]; @@ -476,7 +476,7 @@ bool ComputeFramesOfKeyboardParts(UIView* inputAccessoryView, value:strongValue type:strongType webState:webState - completionHandler:readyCompletion]; + accessoryViewUpdateBlock:readyCompletion]; }; // Run all the blocks in |findProviderBlocks| until one invokes its diff --git a/ios/chrome/browser/autofill/form_suggestion_controller.mm b/ios/chrome/browser/autofill/form_suggestion_controller.mm index d8a0a52..89f5fbc 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller.mm @@ -52,7 +52,8 @@ AutofillSuggestionState::AutofillSuggestionState(const std::string& form_name, base::WeakNSProtocol> _delegate; // Callback to update the accessory view. - base::mac::ScopedBlock completionHandler_; + base::mac::ScopedBlock + accessoryViewUpdateBlock_; // Autofill suggestion state. scoped_ptr _suggestionState; @@ -261,17 +262,18 @@ AutofillSuggestionState::AutofillSuggestionState(const std::string& form_name, - (void)updateKeyboard:(AutofillSuggestionState*)suggestionState { if (!_suggestionState) { - if (completionHandler_) - completionHandler_.get()(nil, self); + if (accessoryViewUpdateBlock_) + accessoryViewUpdateBlock_.get()(nil, self); } else { [self updateKeyboardWithSuggestions:_suggestionState->suggestions]; } } - (void)updateKeyboardWithSuggestions:(NSArray*)suggestions { - if (completionHandler_) - completionHandler_.get()([self suggestionViewWithSuggestions:suggestions], - self); + if (accessoryViewUpdateBlock_) { + accessoryViewUpdateBlock_.get()( + [self suggestionViewWithSuggestions:suggestions], self); + } } - (UIView*)suggestionViewWithSuggestions:(NSArray*)suggestions { @@ -312,12 +314,13 @@ AutofillSuggestionState::AutofillSuggestionState(const std::string& form_name, _delegate.reset(delegate); } -- (void)checkIfAccessoryViewAvailableForFormNamed:(const std::string&)formName - fieldName:(const std::string&)fieldName - webState:(web::WebState*)webState - completionHandler: - (AccessoryViewAvailableCompletion) - completionHandler { +- (void) + checkIfAccessoryViewIsAvailableForFormNamed:(const std::string&)formName + fieldName:(const std::string&)fieldName + webState:(web::WebState*)webState + completionHandler: + (AccessoryViewAvailableCompletion) + completionHandler { [self processPage:webState]; completionHandler(YES); } @@ -327,12 +330,12 @@ AutofillSuggestionState::AutofillSuggestionState(const std::string& form_name, value:(const std::string&)value type:(const std::string&)type webState:(web::WebState*)webState - completionHandler: - (AccessoryViewReadyCompletion)completionHandler { + accessoryViewUpdateBlock: + (AccessoryViewReadyCompletion)accessoryViewUpdateBlock { _suggestionState.reset( new AutofillSuggestionState(formName, fieldName, value)); - completionHandler([self suggestionViewWithSuggestions:@[]], self); - completionHandler_.reset([completionHandler copy]); + accessoryViewUpdateBlock([self suggestionViewWithSuggestions:@[]], self); + accessoryViewUpdateBlock_.reset([accessoryViewUpdateBlock copy]); [self retrieveSuggestionsForFormNamed:formName fieldName:fieldName type:type @@ -341,7 +344,7 @@ AutofillSuggestionState::AutofillSuggestionState(const std::string& form_name, - (void)inputAccessoryViewControllerDidReset: (FormInputAccessoryViewController*)controller { - completionHandler_.reset(); + accessoryViewUpdateBlock_.reset(); [self resetSuggestionState]; } -- cgit v1.1