Delete delegates in WindowState when window is being destroyed

Pinned app can request restore during destruction, (which itself
shouldn't happen), but the windowstate should also have a safe guard
by deleting delegate when being deleted.

TEST=covered by unit tests

Change-Id: I4de6608e97dcf9e48531d31b07a530c10ef68978
Reviewed-by: Ahmed Fakhry <>
Commit-Queue: Mitsuru Oshima <>
Cr-Original-Commit-Position: refs/heads/master@{#538262}(cherry picked from commit 64bf482feb86ae02503c588cad1cb56e46c31b1d)
Reviewed-by: Mitsuru Oshima <>
Cr-Commit-Position: refs/branch-heads/3325@{#609}
Cr-Branched-From: bc084a8b5afa3744a74927344e304c02ae54189f-refs/heads/master@{#530369}
6 files changed