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) { ...@@ -979,7 +979,7 @@ void AppLauncherHandler::HandleInstallAppLocally(const base::ListValue* args) {
app_id, app_id,
base::BindOnce(&AppLauncherHandler::OnOsHooksInstalled, base::BindOnce(&AppLauncherHandler::OnOsHooksInstalled,
weak_ptr_factory_.GetWeakPtr(), app_id), 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 // Use the appAdded to update the app icon's color to no longer be
// greyscale. // greyscale.
......
...@@ -66,12 +66,6 @@ void AppShortcutManager::Shutdown() { ...@@ -66,12 +66,6 @@ void AppShortcutManager::Shutdown() {
app_registrar_observer_.RemoveAll(); 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, void AppShortcutManager::OnWebAppManifestUpdated(const AppId& app_id,
base::StringPiece old_name) { base::StringPiece old_name) {
if (!CanCreateShortcuts()) if (!CanCreateShortcuts())
......
...@@ -46,7 +46,6 @@ class AppShortcutManager : public AppRegistrarObserver { ...@@ -46,7 +46,6 @@ class AppShortcutManager : public AppRegistrarObserver {
void Shutdown(); void Shutdown();
// AppRegistrarObserver: // AppRegistrarObserver:
void OnWebAppInstalled(const AppId& app_id) override;
void OnWebAppManifestUpdated(const web_app::AppId& app_id, void OnWebAppManifestUpdated(const web_app::AppId& app_id,
base::StringPiece old_name) override; base::StringPiece old_name) override;
void OnWebAppProfileWillBeDeleted(const AppId& app_id) override; void OnWebAppProfileWillBeDeleted(const AppId& app_id) override;
......
...@@ -10,12 +10,17 @@ ...@@ -10,12 +10,17 @@
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/threading/sequenced_task_runner_handle.h" #include "base/threading/sequenced_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/components/app_shortcut_manager.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/file_handler_manager.h"
#include "chrome/browser/web_applications/components/web_app_ui_manager.h" #include "chrome/browser/web_applications/components/web_app_ui_manager.h"
#include "chrome/common/chrome_features.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 { namespace web_app {
// This is adapted from base/barrier_closure.cc. os_hooks_results is maintained // This is adapted from base/barrier_closure.cc. os_hooks_results is maintained
...@@ -38,7 +43,7 @@ class OsHooksBarrierInfo { ...@@ -38,7 +43,7 @@ class OsHooksBarrierInfo {
private: private:
OsHooksResults os_hooks_results_{false}; OsHooksResults os_hooks_results_{false};
std::bitset<OsHookType::kMaxValue + 1> os_hooks_called_{false}; OsHooksResults os_hooks_called_{false};
InstallOsHooksCallback done_callback_; InstallOsHooksCallback done_callback_;
}; };
...@@ -72,6 +77,11 @@ void OsIntegrationManager::InstallOsHooks( ...@@ -72,6 +77,11 @@ void OsIntegrationManager::InstallOsHooks(
std::move(callback).Run(os_hooks_results); std::move(callback).Run(os_hooks_results);
return; 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 // 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 // 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 // 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