Commit e3be351b authored by Findit's avatar Findit

Revert "dpwas: Move delete shared mac shim to behind shortcuts"

This reverts commit b94143e8.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 825165 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2I5NDE0M2U4Yzk4ZjcyYmY1MjNmZmRkOTZmMDI5M2Y3MGMxOWZmNmMM

Sample Failed Build: https://ci.chromium.org/b/8864308609828715584

Sample Failed Step: browser_tests

Original change's description:
> dpwas: Move delete shared mac shim to behind shortcuts
> 
> While working on Run On OS Login for Mac, I noticed that the shared
> app shims were being deleted when toggling Run On OS Login. This happens
> because the app shims unconditionally delete the app shims.
> 
> This change moves the code to delete the shared app shims behind
> the shortcut check. On Mac you can have both per profile shims,
> and shared shims, so the callbacks are chained together only on
> that platform.
> 
> Bug: 897302
> Change-Id: I318137ac0f34e4f2429a5119d47e3fe5c3c96892
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519877
> Commit-Queue: Mike Jackson <mjackson@microsoft.com>
> Reviewed-by: Daniel Murphy <dmurph@chromium.org>
> Reviewed-by: ccameron <ccameron@chromium.org>
> Reviewed-by: Phillis Tang <phillis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#825165}


Change-Id: Idfb5e8fdf86e6fdf1aa1557b78d1e3ab2c8100e7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 897302
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2524282
Cr-Commit-Position: refs/heads/master@{#825183}
parent 6e166893
...@@ -199,8 +199,7 @@ void OsIntegrationManager::UninstallOsHooks(const AppId& app_id, ...@@ -199,8 +199,7 @@ void OsIntegrationManager::UninstallOsHooks(const AppId& app_id,
if (os_hooks[OsHookType::kShortcuts]) { if (os_hooks[OsHookType::kShortcuts]) {
internals::ScheduleDeletePlatformShortcuts( internals::ScheduleDeletePlatformShortcuts(
shortcut_data_dir, std::move(shortcut_info), shortcut_data_dir, std::move(shortcut_info),
base::BindOnce(&OsIntegrationManager::OnShortcutsDeleted, base::BindOnce(barrier, OsHookType::kShortcuts));
weak_ptr_factory_.GetWeakPtr(), app_id, barrier));
} else { } else {
barrier.Run(OsHookType::kShortcuts, /*completed=*/true); barrier.Run(OsHookType::kShortcuts, /*completed=*/true);
} }
...@@ -214,6 +213,8 @@ void OsIntegrationManager::UninstallOsHooks(const AppId& app_id, ...@@ -214,6 +213,8 @@ void OsIntegrationManager::UninstallOsHooks(const AppId& app_id,
if (os_hooks[OsHookType::kFileHandlers]) if (os_hooks[OsHookType::kFileHandlers])
file_handler_manager_->DisableAndUnregisterOsFileHandlers(app_id); file_handler_manager_->DisableAndUnregisterOsFileHandlers(app_id);
barrier.Run(OsHookType::kFileHandlers, /*completed=*/true); barrier.Run(OsHookType::kFileHandlers, /*completed=*/true);
DeleteSharedAppShims(app_id);
} }
void OsIntegrationManager::UpdateOsHooks( void OsIntegrationManager::UpdateOsHooks(
...@@ -366,21 +367,17 @@ void OsIntegrationManager::OnShortcutsCreated( ...@@ -366,21 +367,17 @@ void OsIntegrationManager::OnShortcutsCreated(
} }
} }
void OsIntegrationManager::OnShortcutsDeleted( void OsIntegrationManager::DeleteSharedAppShims(const AppId& app_id) {
const AppId& app_id,
base::RepeatingCallback<void(OsHookType::Type os_hook, bool deleted)>
barrier_callback,
bool shortcuts_deleted) {
#if defined(OS_MAC) #if defined(OS_MAC)
bool delete_multi_profile_shortcuts = bool delete_multi_profile_shortcuts =
AppShimRegistry::Get()->OnAppUninstalledForProfile(app_id, AppShimRegistry::Get()->OnAppUninstalledForProfile(app_id,
profile_->GetPath()); profile_->GetPath());
if (delete_multi_profile_shortcuts) { if (delete_multi_profile_shortcuts) {
internals::ScheduleDeleteMultiProfileShortcutsForApp( web_app::internals::GetShortcutIOTaskRunner()->PostTask(
app_id, base::BindOnce(barrier_callback, OsHookType::kRunOnOsLogin)); FROM_HERE,
base::BindOnce(&web_app::internals::DeleteMultiProfileShortcutsForApp,
app_id));
} }
#else
barrier_callback.Run(OsHookType::kShortcuts, /*completed=*/shortcuts_deleted);
#endif #endif
} }
......
...@@ -150,12 +150,6 @@ class OsIntegrationManager { ...@@ -150,12 +150,6 @@ class OsIntegrationManager {
bool created)> callback, bool created)> callback,
bool shortcuts_created); bool shortcuts_created);
void OnShortcutsDeleted(
const AppId& app_id,
base::RepeatingCallback<void(OsHookType::Type os_hook, bool deleted)>
barrier_callback,
bool shortcuts_deleted);
void RegisterRunOnOsLogin(const AppId& app_id, void RegisterRunOnOsLogin(const AppId& app_id,
RegisterRunOnOsLoginCallback callback); RegisterRunOnOsLoginCallback callback);
...@@ -163,6 +157,8 @@ class OsIntegrationManager { ...@@ -163,6 +157,8 @@ class OsIntegrationManager {
RegisterRunOnOsLoginCallback callback, RegisterRunOnOsLoginCallback callback,
std::unique_ptr<ShortcutInfo> info); std::unique_ptr<ShortcutInfo> info);
void DeleteSharedAppShims(const AppId& app_id);
Profile* const profile_; Profile* const profile_;
AppRegistrar* registrar_ = nullptr; AppRegistrar* registrar_ = nullptr;
WebAppUiManager* ui_manager_ = nullptr; WebAppUiManager* ui_manager_ = nullptr;
......
...@@ -80,14 +80,6 @@ void DeletePlatformShortcutsAndPostCallback( ...@@ -80,14 +80,6 @@ void DeletePlatformShortcutsAndPostCallback(
FROM_HERE, base::BindOnce(std::move(callback), shortcut_deleted)); FROM_HERE, base::BindOnce(std::move(callback), shortcut_deleted));
} }
void DeleteMultiProfileShortcutsForAppAndPostCallback(
const std::string& app_id,
CreateShortcutsCallback callback) {
web_app::internals::DeleteMultiProfileShortcutsForApp(app_id);
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(std::move(callback), true));
}
} // namespace } // namespace
ShortcutInfo::ShortcutInfo() = default; ShortcutInfo::ShortcutInfo() = default;
...@@ -194,17 +186,6 @@ void ScheduleDeletePlatformShortcuts( ...@@ -194,17 +186,6 @@ void ScheduleDeletePlatformShortcuts(
std::move(shortcut_info)); std::move(shortcut_info));
} }
void ScheduleDeleteMultiProfileShortcutsForApp(
const std::string& app_id,
DeleteShortcutsCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
GetShortcutIOTaskRunner()->PostTask(
FROM_HERE,
base::BindOnce(&DeleteMultiProfileShortcutsForAppAndPostCallback, app_id,
std::move(callback)));
}
void PostShortcutIOTaskAndReply( void PostShortcutIOTaskAndReply(
base::OnceCallback<void(const ShortcutInfo&)> task, base::OnceCallback<void(const ShortcutInfo&)> task,
std::unique_ptr<ShortcutInfo> shortcut_info, std::unique_ptr<ShortcutInfo> shortcut_info,
......
...@@ -164,10 +164,6 @@ void ScheduleDeletePlatformShortcuts( ...@@ -164,10 +164,6 @@ void ScheduleDeletePlatformShortcuts(
std::unique_ptr<ShortcutInfo> shortcut_info, std::unique_ptr<ShortcutInfo> shortcut_info,
DeleteShortcutsCallback callback); DeleteShortcutsCallback callback);
void ScheduleDeleteMultiProfileShortcutsForApp(
const std::string& app_id,
DeleteShortcutsCallback callback);
// Delete all the shortcuts we have added for this extension. This is the // Delete all the shortcuts we have added for this extension. This is the
// platform specific implementation of the DeleteAllShortcuts function, and // platform specific implementation of the DeleteAllShortcuts function, and
// is executed on the FILE thread. // is executed on the FILE thread.
......
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