-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
StartupPaintPreviewHelperSupplier.java
36 lines (31 loc) · 1.32 KB
/
StartupPaintPreviewHelperSupplier.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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);
}
}