From 4d1bb9bb8e9a288c79192a9b1f5676170f1603ed Mon Sep 17 00:00:00 2001 From: Gauthier Ambard Date: Tue, 28 Jun 2022 19:51:22 +0000 Subject: [PATCH] [iOS] Change pipes to backticks in /ios/chrome/browser/autofill Please review the CL to ensure that nothing is broken and the script didn't miss some pipes. This should allow us to have a better formatting in Xcode. This CL was uploaded by git cl split. R=olivierrobin@chromium.org Bug: 1311955 Change-Id: Ib501643b22baa616dfc3519dc9cde8241face3e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3714315 Reviewed-by: Olivier Robin Auto-Submit: Gauthier Ambard Commit-Queue: Gauthier Ambard Cr-Commit-Position: refs/heads/main@{#1018811} --- .../autofill_controller_js_unittest.mm | 82 +++++++++---------- .../autofill/autofill_controller_unittest.mm | 16 ++-- .../autofill_java_script_feature_unittest.mm | 4 +- .../browser/autofill/autofill_tab_helper.h | 2 +- .../form_input_accessory_view_handler.mm | 14 ++-- .../browser/autofill/form_input_egtest.mm | 2 +- .../browser/autofill/form_input_navigator.h | 4 +- .../form_input_suggestions_provider.h | 2 +- .../autofill/form_structure_browsertest.mm | 6 +- .../autofill/form_suggestion_controller.h | 2 +- .../autofill/form_suggestion_controller.mm | 46 +++++------ .../form_suggestion_controller_unittest.mm | 2 +- .../browser/autofill/form_suggestion_label.h | 2 +- .../browser/autofill/form_suggestion_label.mm | 8 +- .../autofill/form_suggestion_tab_helper.h | 2 +- .../browser/autofill/form_suggestion_view.h | 2 +- ...controller_java_script_feature_unittest.mm | 20 ++--- 17 files changed, 107 insertions(+), 109 deletions(-) diff --git a/ios/chrome/browser/autofill/autofill_controller_js_unittest.mm b/ios/chrome/browser/autofill/autofill_controller_js_unittest.mm index 8ee5c090401b01..e4a0a3b867f62f 100644 --- a/ios/chrome/browser/autofill/autofill_controller_js_unittest.mm +++ b/ios/chrome/browser/autofill/autofill_controller_js_unittest.mm @@ -36,7 +36,7 @@ struct ElementByName { // The name of the element. const char* element_name; - // The index in the elements that have |element_name|. + // The index in the elements that have `element_name`. const int index; // The option index if the element is a select, -1 otherwise. const int option_index; @@ -62,7 +62,7 @@ return query; } -// Generates an array of JavaScripts that get each element in |elements| by +// Generates an array of JavaScripts that get each element in `elements` by // name. NSArray* GetElementsByNameJavaScripts(const ElementByName elements[], size_t elements_size) { @@ -130,7 +130,7 @@ EXTRACT_VALUE = 1 << 0, // Extract value from WebFormControlElement. EXTRACT_OPTION_TEXT = 1 << 1, // Extract option text from // WebFormSelectElement. Only valid when - // |EXTRACT_VALUE| is set. + // `EXTRACT_VALUE` is set. // This is used for form submission where // human readable value is captured. EXTRACT_OPTIONS = 1 << 2, // Extract options from @@ -141,7 +141,7 @@ EXTRACT_NONE, EXTRACT_VALUE, EXTRACT_OPTION_TEXT, EXTRACT_OPTIONS, }; -// Gets the attributes to check for a mask in |kFormExtractMasks|. +// Gets the attributes to check for a mask in `kFormExtractMasks`. NSArray* GetFormFieldAttributeListsToCheck(NSUInteger mask) { if (!(mask & EXTRACT_VALUE)) { return @[ @@ -736,14 +736,14 @@ // clang-format on -// Generates JavaScripts to check a JavaScripts object |results| with the -// expected values given in |expected|, which is a dictionary with string +// Generates JavaScripts to check a JavaScripts object `results` with the +// expected values given in `expected`, which is a dictionary with string // values for all the keys other than @"option_vaues" and @"option_contents"; // the values of @"option_vaues" and @"option_contents" are arrays of -// strings or undefined. Only attributes in |attributes_to_check| are checked. -// A different expected value is chosen in |expected| for different -// |extract_mask|. -// |index| is the index of the control element in the form. If it is >0, it will +// strings or undefined. Only attributes in `attributes_to_check` are checked. +// A different expected value is chosen in `expected` for different +// `extract_mask`. +// `index` is the index of the control element in the form. If it is >0, it will // be used to generate a name for nameless elements. NSString* GenerateElementItemVerifyingJavaScripts(NSString* results, NSUInteger extract_mask, @@ -789,11 +789,11 @@ return [verifying_javascripts componentsJoinedByString:@"&&"]; } -// Generates JavaScripts to check a JavaScripts array |results| with the -// expected values given in |expected|, which is an array of dictionaries; each -// dictionary is the expected values of the corresponding item in |results|. -// Only attributes in |attributes_to_check| are checked. A different expected -// value is chosen in |expected| for different |extract_mask|. +// Generates JavaScripts to check a JavaScripts array `results` with the +// expected values given in `expected`, which is an array of dictionaries; each +// dictionary is the expected values of the corresponding item in `results`. +// Only attributes in `attributes_to_check` are checked. A different expected +// value is chosen in `expected` for different `extract_mask`. NSString* GenerateTestItemVerifyingJavaScripts(NSString* results, NSUInteger extract_mask, NSArray* expected, @@ -842,60 +842,60 @@ return main_frame; } - // Helper method that EXPECTs |javascript| evaluation on page - // |kHTMLForTestingElements| with expectation given by - // |elements_with_true_expected|. + // Helper method that EXPECTs `javascript` evaluation on page + // `kHTMLForTestingElements` with expectation given by + // `elements_with_true_expected`. void TestExecutingBooleanJavaScriptOnElement( NSString* javascript, const ElementByName elements_with_true_expected[], size_t size_elements_with_true_expected); // Helper method that EXPECTs - // |__gCrWeb.fill.webFormControlElementToFormField|. This method applies - // |__gCrWeb.fill.webFormControlElementToFormField| on each element in - // |test_data| with all possible extract masks and verify the results. + // `__gCrWeb.fill.webFormControlElementToFormField`. This method applies + // `__gCrWeb.fill.webFormControlElementToFormField` on each element in + // `test_data` with all possible extract masks and verify the results. void TestWebFormControlElementToFormField(NSArray* test_data, NSString* tag_name); - // Helper method for testing |javascripts_statement| that evalutate - // |attribute_name| of the elements in |test_data| which has tag name - // |tag_name|. EXPECTs JavaScript evaluation on + // Helper method for testing `javascripts_statement` that evalutate + // `attribute_name` of the elements in `test_data` which has tag name + // `tag_name`. EXPECTs JavaScript evaluation on // "window.document.getElementsByTagName()" void TestInputElementDataEvaluation(NSString* javascripts_statement, NSString* attribute_name, NSArray* test_data, NSString* tag_name); - // Helper method that EXPECTs |__gCrWeb.fill.webFormElementToFormData| on - // a form element obtained by |get_form_element_javascripts|. The results - // are verified with |verifying_java_scripts|. + // Helper method that EXPECTs `__gCrWeb.fill.webFormElementToFormData` on + // a form element obtained by `get_form_element_javascripts`. The results + // are verified with `verifying_java_scripts`. void TestWebFormElementToFormDataForOneForm( NSString* get_form_element_javascripts, NSUInteger extract_mask, NSString* expected_result, NSString* verifying_javascripts); - // EXPECTs |__gCrWeb.fill.webFormElementToFormData| on all the test data. + // EXPECTs `__gCrWeb.fill.webFormElementToFormData` on all the test data. void TestWebFormElementToFormData(NSArray* test_items); - // EXPECTs |__gCrWeb.autofill.extractNewForms| on |html|. + // EXPECTs `__gCrWeb.autofill.extractNewForms` on `html`. void TestExtractNewForms(NSString* html, BOOL is_origin_window_location, NSArray* expected_items); - // Helper method that EXPECTs the |java_script| evaluation results on each - // element obtained by JavaScripts in |get_element_java_scripts|. The + // Helper method that EXPECTs the `java_script` evaluation results on each + // element obtained by JavaScripts in `get_element_java_scripts`. The // expected results are boolean and are true only for elements in - // |get_element_java_scripts_expecting_true| which is subset of - // |get_element_java_scripts|. + // `get_element_java_scripts_expecting_true` which is subset of + // `get_element_java_scripts`. void ExecuteBooleanJavaScriptOnElementsAndCheck( NSString* java_script, NSArray* get_element_java_scripts, NSArray* get_element_java_scripts_expecting_true); - // Helper method that EXPECTs the |java_script| evaluation results on each - // element obtained by scripts in |get_element_javas_cripts|; the expected - // result is the corresponding entry in |expected_results|. + // Helper method that EXPECTs the `java_script` evaluation results on each + // element obtained by scripts in `get_element_javas_cripts`; the expected + // result is the corresponding entry in `expected_results`. void ExecuteJavaScriptOnElementsAndCheck(NSString* java_script, NSArray* get_element_java_scripts, NSArray* expected_results); @@ -910,7 +910,7 @@ void ExecuteJavaScriptOnElementsAndCheck(NSString* java_script, NSString* javascript, const ElementByName elements_with_true_expected[], size_t size_elements_with_true_expected) { - // Elements in |kHTMLForTestingElements|. + // Elements in `kHTMLForTestingElements`. const ElementByName elementsByName[] = { {"hl", 0, -1}, {"firstname", 0, -1}, @@ -1443,9 +1443,9 @@ void ExecuteJavaScriptOnElementsAndCheck(NSString* java_script, "@')[%" PRIuNS "]", tag_name, i - 1]; NSDictionary* expected = [test_data objectAtIndex:i]; - // Generates JavaScripts to verify the results. Parameter |results| is + // Generates JavaScripts to verify the results. Parameter `results` is // @"field" as in the evaluation JavaScripts the results are returned in - // |field|. + // `field`. NSString* verifying_javascripts = GenerateElementItemVerifyingJavaScripts( @"field", extract_mask, expected, attributes_to_check, -1); EXPECT_NSEQ( @@ -1774,7 +1774,7 @@ void ExecuteJavaScriptOnElementsAndCheck(NSString* java_script, autofill::FormUtilJavaScriptFeature::GetInstance() ->SetUpForUniqueIDsWithInitialState(main_frame, next_available_id); - // Wait for |SetUpForUniqueIDsWithInitialState| to complete. + // Wait for `SetUpForUniqueIDsWithInitialState` to complete. ASSERT_TRUE(WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^bool { return [web::test::ExecuteJavaScript(@"document[__gCrWeb.fill.ID_SYMBOL]", web_state()) intValue] == @@ -1976,7 +1976,7 @@ void ExecuteJavaScriptOnElementsAndCheck(NSString* java_script, autofill::FormUtilJavaScriptFeature::GetInstance() ->SetUpForUniqueIDsWithInitialState(main_frame, next_available_id); - // Wait for |SetUpForUniqueIDsWithInitialState| to complete. + // Wait for `SetUpForUniqueIDsWithInitialState` to complete. ASSERT_TRUE(WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^bool { return [web::test::ExecuteJavaScript(@"document[__gCrWeb.fill.ID_SYMBOL]", web_state()) intValue] == diff --git a/ios/chrome/browser/autofill/autofill_controller_unittest.mm b/ios/chrome/browser/autofill/autofill_controller_unittest.mm index 2efff62d1ae1dc..2ca52af457a4f5 100644 --- a/ios/chrome/browser/autofill/autofill_controller_unittest.mm +++ b/ios/chrome/browser/autofill/autofill_controller_unittest.mm @@ -140,8 +140,8 @@ - (void)onNoSuggestionsAvailable { NSString* const kCreditCardAutofocusFormHtml = @"
"; -// FAIL if a field with the supplied |name| and |fieldType| is not present on -// the |form|. +// FAIL if a field with the supplied `name` and `fieldType` is not present on +// the `form`. void CheckField(const FormStructure& form, ServerFieldType fieldType, const char* name) { @@ -223,16 +223,16 @@ void OnWebDataServiceRequestDone( void SetUpKeyValueData(); // Blocks until suggestion retrieval has completed. - // If |wait_for_trigger| is yes, wait for the call to - // |retrieveSuggestionsForForm| to avoid considering a former call. + // If `wait_for_trigger` is yes, wait for the call to + // `retrieveSuggestionsForForm` to avoid considering a former call. void WaitForSuggestionRetrieval(BOOL wait_for_trigger); - // Blocks until |expected_size| forms have been fecthed. + // Blocks until `expected_size` forms have been fetched. [[nodiscard]] bool WaitForFormFetched(BrowserAutofillManager* manager, size_t expected_number_of_forms); // Loads the page and wait until the initial form processing has been done. - // This processing must find |expected_size| forms. + // This processing must find `expected_size` forms. [[nodiscard]] bool LoadHtmlAndWaitForFormFetched( NSString* html, size_t expected_number_of_forms); @@ -591,9 +591,9 @@ void OnWebDataServiceRequestDone( // No value should be returned before anything is loaded via form submission. ASSERT_EQ(0U, consumer.result_.size()); web::test::ExecuteJavaScript(@"submit.click()", web_state()); - // We can't make |consumer| a __block variable because TestConsumer lacks copy + // We can't make `consumer` a __block variable because TestConsumer lacks copy // construction. We just pass a pointer instead as we know that the callback - // is executed within the life-cyle of |consumer|. + // is executed within the life-cyle of `consumer`. TestConsumer* consumer_ptr = &consumer; WaitForCondition(^bool { web_data_service->GetFormValuesForElementName(u"greeting", std::u16string(), diff --git a/ios/chrome/browser/autofill/autofill_java_script_feature_unittest.mm b/ios/chrome/browser/autofill/autofill_java_script_feature_unittest.mm index 1de79f88425270..95ee5322dee83f 100644 --- a/ios/chrome/browser/autofill/autofill_java_script_feature_unittest.mm +++ b/ios/chrome/browser/autofill/autofill_java_script_feature_unittest.mm @@ -105,7 +105,7 @@ void LoadHtml(NSString* html) { autofill::FormUtilJavaScriptFeature::GetInstance() ->SetUpForUniqueIDsWithInitialState(main_frame, next_available_id); - // Wait for |SetUpForUniqueIDsWithInitialState| to complete. + // Wait for `SetUpForUniqueIDsWithInitialState` to complete. ASSERT_TRUE(WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^bool { return [web::test::ExecuteJavaScript(@"document[__gCrWeb.fill.ID_SYMBOL]", web_state()) intValue] == @@ -147,7 +147,7 @@ void RunFormsSearch() { std::unique_ptr web_state_; }; -// Tests that |hasBeenInjected| returns YES after |inject| call. +// Tests that `hasBeenInjected` returns YES after `inject` call. TEST_F(AutofillJavaScriptFeatureTest, InitAndInject) { LoadHtml(@""); EXPECT_NSEQ(@"object", web::test::ExecuteJavaScript( diff --git a/ios/chrome/browser/autofill/autofill_tab_helper.h b/ios/chrome/browser/autofill/autofill_tab_helper.h index 39fe06980d7fba..009ab3a5961f8b 100644 --- a/ios/chrome/browser/autofill/autofill_tab_helper.h +++ b/ios/chrome/browser/autofill/autofill_tab_helper.h @@ -32,7 +32,7 @@ class AutofillTabHelper : public web::WebStateObserver, ~AutofillTabHelper() override; - // Create an AutofillTabHelper and attaches it to the given |web_state|. + // Create an AutofillTabHelper and attaches it to the given `web_state`. static void CreateForWebState( web::WebState* web_state, password_manager::PasswordManager* password_manager); diff --git a/ios/chrome/browser/autofill/form_input_accessory_view_handler.mm b/ios/chrome/browser/autofill/form_input_accessory_view_handler.mm index b9864b60020b8c..80366494a2844b 100644 --- a/ios/chrome/browser/autofill/form_input_accessory_view_handler.mm +++ b/ios/chrome/browser/autofill/form_input_accessory_view_handler.mm @@ -55,8 +55,8 @@ FormInputAccessoryAction UMAActionForAssistAction(NSString* assistAction) { namespace { -// Finds all views of a particular kind if class |aClass| in the subview -// hierarchy of the given |root| view. +// Finds all views of a particular kind if class `aClass` in the subview +// hierarchy of the given `root` view. NSArray* SubviewsWithClass(UIView* root, Class aClass) { DCHECK(root); NSMutableArray* viewsToExamine = [NSMutableArray arrayWithObject:root]; @@ -74,7 +74,7 @@ FormInputAccessoryAction UMAActionForAssistAction(NSString* assistAction) { return subviews; } -// Returns true if |item|'s action name contains |actionName|. +// Returns true if `item`'s action name contains `actionName`. BOOL ItemActionMatchesName(UIBarButtonItem* item, NSString* actionName) { SEL itemAction = [item action]; if (!itemAction) @@ -85,9 +85,9 @@ BOOL ItemActionMatchesName(UIBarButtonItem* item, NSString* actionName) { return [itemActionName rangeOfString:actionName].location != NSNotFound; } -// Finds all UIToolbarItems associated with a given UIToolbar |toolbar| with +// Finds all UIToolbarItems associated with a given UIToolbar `toolbar` with // action selectors with a name that contains the action name specified by -// |actionName|. +// `actionName`. NSArray* FindToolbarItemsForActionName(UIToolbar* toolbar, NSString* actionName) { NSMutableArray* toolbarItems = [NSMutableArray array]; @@ -101,7 +101,7 @@ BOOL ItemActionMatchesName(UIBarButtonItem* item, NSString* actionName) { } // Finds all UIToolbarItem(s) with action selectors of the name specified by -// |actionName| in any UIToolbars in the view hierarchy below |root|. +// `actionName` in any UIToolbars in the view hierarchy below `root`. NSArray* FindDescendantToolbarItemsForActionName(UIView* root, NSString* actionName) { NSMutableArray* descendants = [NSMutableArray array]; @@ -116,7 +116,7 @@ BOOL ItemActionMatchesName(UIBarButtonItem* item, NSString* actionName) { } // Finds all UIBarButtonItem(s) with action selectors of the name specified by -// |actionName| in the UITextInputAssistantItem passed. +// `actionName` in the UITextInputAssistantItem passed. NSArray* FindDescendantToolbarItemsForActionName( UITextInputAssistantItem* inputAssistantItem, NSString* actionName) { diff --git a/ios/chrome/browser/autofill/form_input_egtest.mm b/ios/chrome/browser/autofill/form_input_egtest.mm index 20f143babc3493..34e4c121817952 100644 --- a/ios/chrome/browser/autofill/form_input_egtest.mm +++ b/ios/chrome/browser/autofill/form_input_egtest.mm @@ -42,7 +42,7 @@ return result.is_string() ? base::SysUTF8ToNSString(result.GetString()) : @""; } -// Verifies that |elementId| is the selected element in the web page. +// Verifies that `elementId` is the selected element in the web page. void AssertElementIsFocused(const std::string& element_id) { NSString* description = [NSString stringWithFormat:@"Timeout waiting for the focused element in " diff --git a/ios/chrome/browser/autofill/form_input_navigator.h b/ios/chrome/browser/autofill/form_input_navigator.h index f03704f41df199..6d114d2aa5b1b8 100644 --- a/ios/chrome/browser/autofill/form_input_navigator.h +++ b/ios/chrome/browser/autofill/form_input_navigator.h @@ -30,9 +30,9 @@ // Called when updating the keyboard view. Checks if the page contains a next // and a previous element. -// |completionHandler| is called with 2 bools, the first indicating if a +// `completionHandler` is called with 2 bools, the first indicating if a // previous element was found, and the second indicating if a next element was -// found. |completionHandler| cannot be nil. +// found. `completionHandler` cannot be nil. - (void)fetchPreviousAndNextElementsPresenceWithCompletionHandler: (void (^)(bool, bool))completionHandler; diff --git a/ios/chrome/browser/autofill/form_input_suggestions_provider.h b/ios/chrome/browser/autofill/form_input_suggestions_provider.h index fbb39f3016f1e8..f1aae1e3ab8e32 100644 --- a/ios/chrome/browser/autofill/form_input_suggestions_provider.h +++ b/ios/chrome/browser/autofill/form_input_suggestions_provider.h @@ -38,7 +38,7 @@ typedef void (^FormSuggestionsReadyCompletion)( @property(nonatomic, readonly) SuggestionProviderType type; // Asynchronously retrieves form suggestions from this provider for the -// specified form/field and returns it via |accessoryViewUpdateBlock|. View +// specified form/field and returns it via `accessoryViewUpdateBlock`. View // will be nil if no accessories are available from this provider. - (void)retrieveSuggestionsForForm:(const autofill::FormActivityParams&)params webState:(web::WebState*)webState diff --git a/ios/chrome/browser/autofill/form_structure_browsertest.mm b/ios/chrome/browser/autofill/form_structure_browsertest.mm index 8618e42977e215..24722a4d8c71c7 100644 --- a/ios/chrome/browser/autofill/form_structure_browsertest.mm +++ b/ios/chrome/browser/autofill/form_structure_browsertest.mm @@ -138,7 +138,7 @@ // DataDrivenTest: void GenerateResults(const std::string& input, std::string* output) override; - // Serializes the given |forms| into a string. + // Serializes the given `forms` into a string. std::string FormStructuresToString( const std::map>& forms); @@ -261,7 +261,7 @@ autofill::FormUtilJavaScriptFeature::GetInstance() ->SetUpForUniqueIDsWithInitialState(main_frame, next_available_id); - // Wait for |SetUpForUniqueIDsWithInitialState| to complete. + // Wait for `SetUpForUniqueIDsWithInitialState` to complete. return WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^bool { return [web::test::ExecuteJavaScript(@"document[__gCrWeb.fill.ID_SYMBOL]", web_state()) intValue] == @@ -312,7 +312,7 @@ } // Normalize the section by replacing the unique but platform-dependent - // integers in |field->section| with consecutive unique integers. + // integers in `field->section` with consecutive unique integers. // The section string is of the form "fieldname_id1_id2-suffix", where // id1, id2 are platform-dependent and thus need to be substituted. size_t last_underscore = section.find_last_of('_'); diff --git a/ios/chrome/browser/autofill/form_suggestion_controller.h b/ios/chrome/browser/autofill/form_suggestion_controller.h index ce017ba9c6add3..edf6bba95d2773 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller.h +++ b/ios/chrome/browser/autofill/form_suggestion_controller.h @@ -30,7 +30,7 @@ class WebState; // Initializes a new FormSuggestionController with the specified WebState and a // list of FormSuggestionProviders. -// When suggestions are required for an input field, the |providers| will be +// When suggestions are required for an input field, the `providers` will be // asked (in order) if they can handle the field; the first provider to return // YES from [FormSuggestionProvider canProviderSuggestionsForForm:field:] will // be expected to provide those suggestions using [FormSuggestionProvider diff --git a/ios/chrome/browser/autofill/form_suggestion_controller.mm b/ios/chrome/browser/autofill/form_suggestion_controller.mm index 755f9b9fc22b8b..e0610203b954d4 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller.mm @@ -52,7 +52,7 @@ std::string frame_identifier; // The user-typed value in the field. std::string typed_value; - // The suggestions for the form field. An array of |FormSuggestion|. + // The suggestions for the form field. An array of `FormSuggestion`. NSArray* suggestions; }; @@ -90,10 +90,10 @@ @interface FormSuggestionController () { // Unique id of the last request. @property(nonatomic, assign) NSUInteger requestIdentifier; -// Updates keyboard for |suggestionState|. +// Updates keyboard for `suggestionState`. - (void)updateKeyboard:(AutofillSuggestionState*)suggestionState; -// Updates keyboard with |suggestions|. +// Updates keyboard with `suggestions`. - (void)updateKeyboardWithSuggestions:(NSArray*)suggestions; // Clears state in between page loads. @@ -192,23 +192,21 @@ - (void)retrieveSuggestionsForForm:(const autofill::FormActivityParams&)params // and NO otherwise. NSMutableArray* findProviderBlocks = [[NSMutableArray alloc] init]; for (NSUInteger i = 0; i < [_suggestionProviders count]; i++) { - passwords::PipelineBlock block = - ^(void (^completion)(BOOL success)) { - // Access all the providers through |self| to guarantee that both - // |self| and all the providers exist when the block is executed. - // |_suggestionProviders| is immutable, so the subscripting is - // always valid. - FormSuggestionController* strongSelf = weakSelf; - if (!strongSelf) - return; - id provider = - strongSelf->_suggestionProviders[i]; - [provider checkIfSuggestionsAvailableForForm:formQuery - isMainFrame:isMainFrame - hasUserGesture:hasUserGesture - webState:webState - completionHandler:completion]; - }; + passwords::PipelineBlock block = ^(void (^completion)(BOOL success)) { + // Access all the providers through `self` to guarantee that both + // `self` and all the providers exist when the block is executed. + // `_suggestionProviders` is immutable, so the subscripting is + // always valid. + FormSuggestionController* strongSelf = weakSelf; + if (!strongSelf) + return; + id provider = strongSelf->_suggestionProviders[i]; + [provider checkIfSuggestionsAvailableForForm:formQuery + isMainFrame:isMainFrame + hasUserGesture:hasUserGesture + webState:webState + completionHandler:completion]; + }; [findProviderBlocks addObject:block]; } @@ -239,9 +237,9 @@ - (void)retrieveSuggestionsForForm:(const autofill::FormActivityParams&)params completionHandler:readyCompletion]; }; - // Run all the blocks in |findProviderBlocks| until one invokes its + // Run all the blocks in `findProviderBlocks` until one invokes its // completion with YES. The first one to do so will be passed to - // |completion|. + // `completion`. passwords::RunSearchPipeline(findProviderBlocks, completion); } @@ -256,8 +254,8 @@ - (void)onNoSuggestionsAvailable { - (void)onSuggestionsReady:(NSArray*)suggestions provider:(id)provider { // TODO(ios): crbug.com/249916. If we can also pass in the form/field for - // which |suggestions| are, we should check here if |suggestions| are for - // the current active element. If not, reset |_suggestionState|. + // which `suggestions` are, we should check here if `suggestions` are for + // the current active element. If not, reset `_suggestionState`. if (!_suggestionState) { // The suggestion state was reset in between the call to Autofill API (e.g. // OnAskForValuesToFill) and this method being called back. Results are diff --git a/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm b/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm index 6622b67cc7c302..4da4884524261b 100644 --- a/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm +++ b/ios/chrome/browser/autofill/form_suggestion_controller_unittest.mm @@ -174,7 +174,7 @@ void TearDown() override { } protected: - // Sets up |suggestion_controller_| with the specified array of + // Sets up `suggestion_controller_` with the specified array of // FormSuggestionProviders. void SetUpController(NSArray* providers) { suggestion_controller_ = diff --git a/ios/chrome/browser/autofill/form_suggestion_label.h b/ios/chrome/browser/autofill/form_suggestion_label.h index c8fa187271d3b9..e7858cf45eb445 100644 --- a/ios/chrome/browser/autofill/form_suggestion_label.h +++ b/ios/chrome/browser/autofill/form_suggestion_label.h @@ -23,7 +23,7 @@ // Class for Autofill suggestion in the customized keyboard. @interface FormSuggestionLabel : UIView -// Designated initializer. Initializes with |delegate| for |suggestion|. +// Designated initializer. Initializes with `delegate` for `suggestion`. - (instancetype)initWithSuggestion:(FormSuggestion*)suggestion index:(NSUInteger)index numSuggestions:(NSUInteger)numSuggestions diff --git a/ios/chrome/browser/autofill/form_suggestion_label.mm b/ios/chrome/browser/autofill/form_suggestion_label.mm index 8af8c60a782501..0e2f64c434b034 100644 --- a/ios/chrome/browser/autofill/form_suggestion_label.mm +++ b/ios/chrome/browser/autofill/form_suggestion_label.mm @@ -49,7 +49,7 @@ NSString* image_name; }; -// Creates a label with the given |text| and |alpha| suitable for use in a +// Creates a label with the given `text` and `alpha` suitable for use in a // suggestion button in the keyboard accessory view. UILabel* TextLabel(NSString* text, UIColor* textColor, BOOL bold) { UILabel* label = [[UILabel alloc] init]; @@ -150,8 +150,8 @@ - (void)layoutSubviews { self.layer.cornerRadius = self.bounds.size.height / 2.0; } -// Animates |highlight| property to YES for a duration of -// |animationOnScreenDuration|. +// Animates `highlight` property to YES for a duration of +// `animationOnScreenDuration`. - (void)animateWithHighlight { __weak __typeof(self) weakSelf = self; [self animateWithHighlight:YES @@ -172,7 +172,7 @@ - (void)animateWithHighlight { #pragma mark - Private -// Animates |highlight| property from current state to |highlighted|. +// Animates `highlight` property from current state to `highlighted`. - (void)animateWithHighlight:(BOOL)highlighted completion:(ProceduralBlockWithBool)completion { if (self.highlighted == highlighted) { diff --git a/ios/chrome/browser/autofill/form_suggestion_tab_helper.h b/ios/chrome/browser/autofill/form_suggestion_tab_helper.h index 0ee5d08bcbba36..289bf01eef224a 100644 --- a/ios/chrome/browser/autofill/form_suggestion_tab_helper.h +++ b/ios/chrome/browser/autofill/form_suggestion_tab_helper.h @@ -24,7 +24,7 @@ class FormSuggestionTabHelper ~FormSuggestionTabHelper() override; - // Creates a FormSuggestionTabHelper and attaches it to the given |web_state|. + // Creates a FormSuggestionTabHelper and attaches it to the given `web_state`. static void CreateForWebState(web::WebState* web_state, NSArray>* providers); diff --git a/ios/chrome/browser/autofill/form_suggestion_view.h b/ios/chrome/browser/autofill/form_suggestion_view.h index c430ebd620bd14..b5426be270afb8 100644 --- a/ios/chrome/browser/autofill/form_suggestion_view.h +++ b/ios/chrome/browser/autofill/form_suggestion_view.h @@ -41,7 +41,7 @@ // The layout guide center to use to refer to the first suggestion label. @property(nonatomic, strong) LayoutGuideCenter* layoutGuideCenter; -// Updates with |suggestions|. +// Updates with `suggestions`. - (void)updateSuggestions:(NSArray*)suggestions; // Reset content insets back to zero and sets the delegate to nil. Used to stop diff --git a/ios/chrome/browser/autofill/suggestion_controller_java_script_feature_unittest.mm b/ios/chrome/browser/autofill/suggestion_controller_java_script_feature_unittest.mm index b58b70396080f2..44450b7ea929f0 100644 --- a/ios/chrome/browser/autofill/suggestion_controller_java_script_feature_unittest.mm +++ b/ios/chrome/browser/autofill/suggestion_controller_java_script_feature_unittest.mm @@ -38,7 +38,7 @@ web_state_->GetView(); web_state_->SetKeepRenderProcessAlive(true); } - // Returns the main frame of |web_state()|'s current page. + // Returns the main frame of `web_state()`'s current page. web::WebFrame* GetMainFrame(); // Helper method that initializes a form with three fields. Can be used to // test whether adding an attribute on the second field causes it to be @@ -49,7 +49,7 @@ return web::test::ExecuteJavaScript(@"document.activeElement.name", web_state()); } - // Waits until the active element is |name|. + // Waits until the active element is `name`. BOOL WaitUntilElementSelected(NSString* name) { return base::test::ios::WaitUntilConditionOrTimeout( base::test::ios::kWaitForJSCompletionTimeout, ^bool { @@ -372,7 +372,7 @@ BOOL WaitUntilElementSelected(NSString* name) { } // Test fixture to test -// |FetchPreviousAndNextElementsPresenceInFrameWithID|. +// `FetchPreviousAndNextElementsPresenceInFrameWithID`. class FetchPreviousAndNextExceptionTest : public SuggestionControllerJavaScriptFeatureTest { public: @@ -383,7 +383,7 @@ void SetUp() override { protected: // Evaluates JS and tests that the completion handler passed to - // |FetchPreviousAndNextElementsPresenceInFrameWithID| is called with + // `FetchPreviousAndNextElementsPresenceInFrameWithID` is called with // (false, false) indicating no previous and next element. void EvaluateJavaScriptAndExpectNoPreviousAndNextElement(NSString* js) { web::test::ExecuteJavaScript(js, web_state()); @@ -403,22 +403,22 @@ void EvaluateJavaScriptAndExpectNoPreviousAndNextElement(NSString* js) { } }; -// Tests that |fetchPreviousAndNextElementsPresenceWithCompletionHandler| works -// when |__gCrWeb.suggestion.hasPreviousElement| throws an exception. +// Tests that `fetchPreviousAndNextElementsPresenceWithCompletionHandler` works +// when `__gCrWeb.suggestion.hasPreviousElement` throws an exception. TEST_F(FetchPreviousAndNextExceptionTest, HasPreviousElementException) { EvaluateJavaScriptAndExpectNoPreviousAndNextElement( @"__gCrWeb.suggestion.hasPreviousElement = function() { bar.foo1; }"); } -// Tests that |fetchPreviousAndNextElementsPresenceWithCompletionHandler| works -// when |__gCrWeb.suggestion.hasNextElement| throws an exception. +// Tests that `fetchPreviousAndNextElementsPresenceWithCompletionHandler` works +// when `__gCrWeb.suggestion.hasNextElement` throws an exception. TEST_F(FetchPreviousAndNextExceptionTest, HasNextElementException) { EvaluateJavaScriptAndExpectNoPreviousAndNextElement( @"__gCrWeb.suggestion.hasNextElement = function() { bar.foo1; }"); } -// Tests that |fetchPreviousAndNextElementsPresenceWithCompletionHandler| works -// when |Array.toString| has been overridden to return a malformed string +// Tests that `fetchPreviousAndNextElementsPresenceWithCompletionHandler` works +// when `Array.toString` has been overridden to return a malformed string // without a ",". TEST_F(FetchPreviousAndNextExceptionTest, HasPreviousElementNull) { EvaluateJavaScriptAndExpectNoPreviousAndNextElement(