• Danan S's avatar
    Refactor the ParentPermissionDialog to prevent memory management issues · 122cf895
    Danan S authored
    This refactor was motivated by revert 71f516df.
    
    Background:
    
    There was an ASAN error that occurred in certain test cases where
    the ParentPermissionDialog was deleted from beneath itself before
    it was able to set its dialog_closed_callback_ member, causing a
    use-after-free.
    
    The use-after-free was caused by the way this feature was originally
    implemented:
    2 objects with distinct lifetimes separately managing the view and
    workflow of the ParentPermissionDialog.   The 2 objects
    spanned sections of the codebase (ui and views) which have dependency
    restrictions that made it very challenging to coordinate the lifetime
    of objects across them.  Furthermore, the flows in this code are full
    of asynchronous sections that necessitated an extra callback-based
    message passing interface between the 2 objects.
    
    This CL consolidates all the existing to a single object:
    ParentPermissionDialogView, thereby removing most of the aforementioned
    dependency and object lifetime management complexity.
    
    The API for creating the dialog remains in parent_permission_dialog.h,
    however it is now in a much simplified form, consisting of a simple
    control  interface and Show() functions.
    
    Original change's description:
    > Revert "Changes to Webstore Private API to support child extension installation"
    >
    > This reverts commit 99ffda8e.
    >
    > Reason for revert: browser_tests failing on https://ci.chromium.org/p/chromium/builders/ci/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29/37129 and https://ci.chromium.org/p/chromium/builders/ci/Linux%20ChromiumOS%20MSan%20Tests/18174
    >
    > Original change's description:
    > > Changes to Webstore Private API to support child extension installation
    > >
    > > These changes are required in order to prompt a child user to get
    > > parent permission when they attempt to install an extension in the
    > > Chrome Webstore.
    > >
    > > This CL also enables the feature by default.
    > >
    > > Bug: 957832
    > > Change-Id: I3a2011b418e31dd491fd35e37d976b492eef197b
    > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079620
    > > Commit-Queue: Dan S <danan@chromium.org>
    > > Reviewed-by: Karan Bhatia <karandeepb@chromium.org>
    > > Cr-Commit-Position: refs/heads/master@{#749436}
    >
    > TBR=karandeepb@chromium.org,danan@chromium.org
    >
    > Change-Id: If262ccd3dad279dc60e849f9780e340b18d7384c
    > No-Presubmit: true
    > No-Tree-Checks: true
    > No-Try: true
    > Bug: 957832
    > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100891
    > Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
    > Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#749726}
    
    Change-Id: Ia217f68502a6fe8719614b1322af74aeb02f3319
    No-Presubmit: false
    No-Tree-Checks: false
    No-Try: false
    Bug: 957832
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100548
    Commit-Queue: Dan S <danan@chromium.org>
    Reviewed-by: default avatarScott Violet <sky@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#753468}
    122cf895
parent_permission_dialog_view.cc 30.4 KB