Commit acab841a authored by Jay Harris's avatar Jay Harris Committed by Commit Bot

WebApps: Use BookmarkAppRegistrar::FindExtension instead of GetByID.

This was causing a crash during uninstallation of apps when file
handling was enabled.

Bug: 1047481
Change-Id: Ib5657eb48b439058e236f9abe91c8c21a0fb3be9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2016783
Commit-Queue: Jay Harris <harrisjay@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738064}
parent abf9a1f5
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <vector> #include <vector>
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/extensions/bookmark_app_registrar.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/file_handler_info.h" #include "extensions/common/manifest_handlers/file_handler_info.h"
...@@ -21,8 +22,10 @@ BookmarkAppFileHandlerManager::~BookmarkAppFileHandlerManager() = default; ...@@ -21,8 +22,10 @@ BookmarkAppFileHandlerManager::~BookmarkAppFileHandlerManager() = default;
const std::vector<apps::FileHandlerInfo>* const std::vector<apps::FileHandlerInfo>*
BookmarkAppFileHandlerManager::GetAllFileHandlers( BookmarkAppFileHandlerManager::GetAllFileHandlers(
const web_app::AppId& app_id) { const web_app::AppId& app_id) {
const Extension* extension = auto* bookmark_app_registrar = registrar()->AsBookmarkAppRegistrar();
ExtensionRegistry::Get(profile())->enabled_extensions().GetByID(app_id); DCHECK(bookmark_app_registrar);
const Extension* extension = bookmark_app_registrar->FindExtension(app_id);
return FileHandlers::GetFileHandlers(extension); return FileHandlers::GetFileHandlers(extension);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment