Code: void AppControllerImpl::GetApps(
     mojom::AppController::GetAppsCallback callback) {
   std::vector<chromeos::kiosk_next_home::mojom::AppPtr> app_list;
  app_service_proxy_->AppRegistryCache().ForEachApp(
      [this, &app_list](const apps::AppUpdate& update) {
        app_list.push_back(CreateAppPtr(update));
      });
   std::move(callback).Run(std::move(app_list));
 }

Commit Message: Refactor the AppController implementation into a KeyedService.

This is necessary to guarantee that the AppController will not outlive
the AppServiceProxy, which could happen before during Profile destruction.

Bug: 945427
Change-Id: I9e2089799e38d5a70a4a9aa66df5319113e7809e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1542336
Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
Commit-Queue: Lucas Tenório <ltenorio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645122}
CWE ID: CWE-416
void AppControllerImpl::GetApps(
void AppControllerService::GetApps(
     mojom::AppController::GetAppsCallback callback) {
   std::vector<chromeos::kiosk_next_home::mojom::AppPtr> app_list;
  app_service_proxy_->AppRegistryCache().ForEachApp(
      [this, &app_list](const apps::AppUpdate& update) {
        app_list.push_back(CreateAppPtr(update));
      });
   std::move(callback).Run(std::move(app_list));
 }
