Create local_card_migration_manager class to manage local card migration(CL#2).

The local_card_migration_manager is the manager to control the local card migration flow, which is similar to the credit_card_save_manager class. The FormDataImporter will trigger the migration when user submit a form using a local card or a server card.

If the user is signed-in and sync, and have [more than one local card when use a local card] or [at least one valid local card when use server card], migration will start to fetch legal docs. When successfully fetch the legal docs, it will pop-up first round window to ask user whether to migrate local card. If user agree, it will pop-up second window with all valid local card for upload. If user agree on the second window, we will sequentially upload valid local cards.

In this CL, we mainly solve the triggering logic for the migration. The logic is mainly in the FormDataImporter and the ShouldOfferLocalCreditCardMigration() in LocalCardMigrationManager. If the migration requirements are met, we will fetch legal docs from the server. If we successfully fetch the legal docs, we will trigger the first round pop-up window to the user. We also add experimental flag in this CL to enable/disable the migration.

For the unittest, we use a variable in the test class as an observer and it is True when successfully fetch the legal docs. We check this variable to test whether the migration is triggered or not. And we also create new constructor in the test_autofill_manager and test_form_data_importer for the new local_card_migration_manager for testing.

The triggered two-round pop-ups windows together with their callback functions will be included in the following CLs.

Bug: 852904
Change-Id: Iadd17b4e36e12bc9ef17075d0703b796d37ed334
Reviewed-on: https://chromium-review.googlesource.com/1111569
Commit-Queue: Sujie Zhu <sujiezhu@google.com>
Reviewed-by: Sebastien Seguin-Gagnon <sebsg@chromium.org>
Reviewed-by: Jared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#575715}
21 files changed