| Index: components/installedapp/android/java/src/org/chromium/device/installedapp/InstalledAppProviderFactory.java
|
| diff --git a/components/installedapp/android/java/src/org/chromium/device/installedapp/InstalledAppProviderFactory.java b/components/installedapp/android/java/src/org/chromium/device/installedapp/InstalledAppProviderFactory.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0a60adc6a18a2e91fb7d2d7bf2a4e52fbf4b1941
|
| --- /dev/null
|
| +++ b/components/installedapp/android/java/src/org/chromium/device/installedapp/InstalledAppProviderFactory.java
|
| @@ -0,0 +1,37 @@
|
| +// Copyright 2015 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.components.installedapp;
|
| +
|
| +import android.content.Context;
|
| +
|
| +import org.chromium.base.ThreadUtils;
|
| +import org.chromium.components.installedapp.InstalledAppProviderImpl;
|
| +import org.chromium.mojom.components.InstalledAppProvider;
|
| +
|
| +/**
|
| + * Serves as a factory for InstalledAppProvider implementation as well as the global (as in the
|
| + * browser process) implementation of the Presentation API on Android.
|
| + */
|
| +public final class InstalledAppProviderFactory {
|
| + public static InstalledAppProviderFactory sInstance;
|
| + private static Context mContext;
|
| +
|
| + public static InstalledAppProviderFactory instance(Context applicationContext) {
|
| + ThreadUtils.assertOnUiThread();
|
| +
|
| + // Need to hold onto this context!
|
| + if (sInstance == null) sInstance = new InstalledAppProviderFactory(applicationContext);
|
| +
|
| + return sInstance;
|
| + }
|
| +
|
| + public InstalledAppProvider createInstalledAppProvider() {
|
| + return new InstalledAppProviderImpl(mContext);
|
| + }
|
| +
|
| + private InstalledAppProviderFactory(Context applicationContext) {
|
| + mContext = applicationContext;
|
| + }
|
| +}
|
|
|