Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Paint Preview] Remove PaintPreviewWindowAndroidHelper class
This CL removes the helper class in StartupPaintPreviewHelper that kept the activity-specific variables and moves all the variables to StartupPaintPreviewHelper instead. UnownedUserDataSupplier is used to supply the StartupPaintPreviewHelper objects per activity. Bug: 1157482 Change-Id: If0bd603f051ae42a56b3f786e60cd2c8ad45ba62 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2584367 Commit-Queue: Yashar Dabiran <yashard@chromium.org> Reviewed-by: Filip Gorski <fgorski@chromium.org> Reviewed-by: Mehran Mahmoudi <mahmoudi@chromium.org> Cr-Commit-Position: refs/heads/master@{#859125}
- Loading branch information
Yashar Dabiran
authored and
Chromium LUCI CQ
committed
Mar 2, 2021
1 parent
83e2f22
commit f9f096e
Showing
4 changed files
with
96 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...java/src/org/chromium/chrome/browser/paint_preview/StartupPaintPreviewHelperSupplier.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2021 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package org.chromium.chrome.browser.paint_preview; | ||
|
||
import org.chromium.base.UnownedUserDataKey; | ||
import org.chromium.base.supplier.ObservableSupplier; | ||
import org.chromium.base.supplier.UnownedUserDataSupplier; | ||
import org.chromium.ui.base.WindowAndroid; | ||
|
||
/** | ||
* A {@link UnownedUserDataSupplier} which manages the supplier and UnownedUserData for a | ||
* {@link StartupPaintPreviewHelper}. | ||
*/ | ||
public class StartupPaintPreviewHelperSupplier | ||
extends UnownedUserDataSupplier<StartupPaintPreviewHelper> { | ||
private static final UnownedUserDataKey<StartupPaintPreviewHelperSupplier> KEY = | ||
new UnownedUserDataKey<>(StartupPaintPreviewHelperSupplier.class); | ||
|
||
/** | ||
* Return {@link StartupPaintPreviewHelper} supplier associated with the given {@link | ||
* WindowAndroid}. | ||
*/ | ||
public static ObservableSupplier<StartupPaintPreviewHelper> from(WindowAndroid windowAndroid) { | ||
return KEY.retrieveDataFromHost(windowAndroid.getUnownedUserDataHost()); | ||
} | ||
|
||
/** | ||
* Constructs a StartupPaintPreviewHelperSupplier and attaches it to the {@link | ||
* WindowAndroid} | ||
*/ | ||
public StartupPaintPreviewHelperSupplier() { | ||
super(KEY); | ||
} | ||
} |