Enrollment logic was extracted from EnrollmentScreen(Handler) in a helper class.
The new class contains the code that retrieves tokens from
profile (moved from EnrollmentScreenHandler), the code that starts
enrollment given a token (moved from EnrollmentScreen), the code
that reports UMA related to tokens fetch and enrollment (moved from
EnrollmentScreen) and the code that cleans profile of authentication
data and revokes tokens if enrollment failed for some reason (moved
from EnrollmentScreenHandler).
EnterpriseEnrollmentHelper provides two entry points:
* EnrollUsingContext, that receives profile containing authentication data.
* EnrollUsingToken, that receives authentication token.
The main reason for this change, is that enrollment functionality
is needed during host/controller pairing. So if we want to avoid
code duplication, we need to extract enrollment code somewhere.
The second reason, EnrollmentScreenHandler is supposed to be a purely UI class.
This CL doesn't change behavior, everything is supposed to work as it worked before.
BUG=405150
TEST=manually,enrollment works,hotrod enrollment works
Review URL: https://codereview.chromium.org/
518513002
Cr-Commit-Position: refs/heads/master@{#305807}