Code: const std::string& AppControllerImpl::MaybeGetAndroidPackageName(
     const std::string& app_id) {
   const auto& package_name_it = android_package_map_.find(app_id);
  if (package_name_it != android_package_map_.end()) {
    return package_name_it->second;
  }

  ArcAppListPrefs* arc_prefs_ = ArcAppListPrefs::Get(profile_);
  if (!arc_prefs_) {
    return base::EmptyString();
  }
  std::unique_ptr<ArcAppListPrefs::AppInfo> arc_info =
      arc_prefs_->GetApp(app_id);
  if (!arc_info) {
    return base::EmptyString();
  }

  android_package_map_[app_id] = arc_info->package_name;
  return android_package_map_[app_id];
}

Vulnerability Type: 
CWE ID: CWE-416
Summary: A heap use after free in PDFium in Google Chrome prior to 54.0.2840.59 for Windows, Mac, and Linux; 54.0.2840.85 for Android allows a remote attacker to potentially exploit heap corruption via crafted PDF files.
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}