[sms] Make the lifecycle of SmsServices be managed by FrameServiceBase

In the current architecture, SmsService is owned by SmsKeyedService which
is owned by Profiles. SmsReceiverImpl is owned by SmsServiceImpl and the
StrongBindingSet, which has no connection (from a memory perspective), to
RenderFrameHosts.

There are no guarantees that the mojo clients are going to outlive the
RenderFrameHosts, so we run into possible cases where SmsReceiverImpl is
handling requests after the RenderFrameHost was destructed (@see bugs).

To address this problem, and make the architecture consistent with other
comparable features, this cl makes the SmsService a subclass of
FrameServiceBase, which is responsible for managing its lifecycle and
memory based on events dispatched by the lifecycle of the RenderFrameHost.

We keep the SmsProvider owned by the BrowserMainLoop, which is effectively
a singleton. To facilitate BrowserTest testing, we expose a
BrowserMainLoop::SetSmsProviderForTesting static method.

Design Doc: https://docs.google.com/document/d/1dB5UM9x8Ap2-bs6Xn0KnbC_B1KNLIUv4W05MunuXYh0/edit#

Bug: 979265,982370,979418
Change-Id: Ic2b0a9b35fa1f5a3e28c84d77d78c22d41b09ad0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1691683
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Jun Cai <juncai@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Sam Goto <goto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678558}
10 files changed