Commit daaaa93b authored by phillis's avatar phillis Committed by Commit Bot

DPWA: Move AppShim update on install to OsIntegrationManager

Moves |AppShimRegistry::OnAppInstalledForProfile| from AppShortcutManager
observer pattern to |OsIntegrationManager::InstallOsHooks|

Bug: 1098027
Change-Id: I102a787aeee35ebed401025eac7cbdd54177f3d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2311115Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Commit-Queue: Phillis Tang <phillis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792377}
parent 45f53f6d
......@@ -979,7 +979,7 @@ void AppLauncherHandler::HandleInstallAppLocally(const base::ListValue* args) {
app_id,
base::BindOnce(&AppLauncherHandler::OnOsHooksInstalled,
weak_ptr_factory_.GetWeakPtr(), app_id),
nullptr, std::move(options));
/*web_application_info=*/nullptr, std::move(options));
// Use the appAdded to update the app icon's color to no longer be
// greyscale.
......
......@@ -66,12 +66,6 @@ void AppShortcutManager::Shutdown() {
app_registrar_observer_.RemoveAll();
}
void AppShortcutManager::OnWebAppInstalled(const AppId& app_id) {
#if defined(OS_MACOSX)
AppShimRegistry::Get()->OnAppInstalledForProfile(app_id, profile_->GetPath());
#endif
}
void AppShortcutManager::OnWebAppManifestUpdated(const AppId& app_id,
base::StringPiece old_name) {
if (!CanCreateShortcuts())
......
......@@ -46,7 +46,6 @@ class AppShortcutManager : public AppRegistrarObserver {
void Shutdown();
// AppRegistrarObserver:
void OnWebAppInstalled(const AppId& app_id) override;
void OnWebAppManifestUpdated(const web_app::AppId& app_id,
base::StringPiece old_name) override;
void OnWebAppProfileWillBeDeleted(const AppId& app_id) override;
......
......@@ -10,12 +10,17 @@
#include "base/feature_list.h"
#include "base/optional.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/components/app_shortcut_manager.h"
#include "chrome/browser/web_applications/components/file_handler_manager.h"
#include "chrome/browser/web_applications/components/web_app_ui_manager.h"
#include "chrome/common/chrome_features.h"
#if defined(OS_MACOSX)
#include "chrome/browser/web_applications/components/app_shim_registry_mac.h"
#endif
namespace web_app {
// This is adapted from base/barrier_closure.cc. os_hooks_results is maintained
......@@ -38,7 +43,7 @@ class OsHooksBarrierInfo {
private:
OsHooksResults os_hooks_results_{false};
std::bitset<OsHookType::kMaxValue + 1> os_hooks_called_{false};
OsHooksResults os_hooks_called_{false};
InstallOsHooksCallback done_callback_;
};
......@@ -72,6 +77,11 @@ void OsIntegrationManager::InstallOsHooks(
std::move(callback).Run(os_hooks_results);
return;
}
#if defined(OS_MACOSX)
AppShimRegistry::Get()->OnAppInstalledForProfile(app_id, profile_->GetPath());
#endif
// Note: This barrier protects against multiple calls on the same type, but
// it doesn't protect against the case where we fail to call Run / create a
// callback for every type. Developers should double check that Run is
......
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